cleaned up debug routines