hardened memory management by casting all mallocs() and setting object pointers to NULL after destroy()ing them.