Adding a calloc helper function
Implementing the finalization part