changed dynamic memory allocation of function pointers to calloc instead of malloc