debugging modified cleanUp code