Add code to delete dynamically allocated memory