Add verbose debugging capabilities to cleanup function

Toggle-able by setting 'debug' in the file to True