added calloc instead of malloc, removed multiple prints and unsed variables