used xcalloc instead of calloc