Added debugging functions to dynamic memory management