code cleanup and memory debugging