add level control to cleanup method