changed from array to calloc