more cleanup, and only print phase-level output to the console if a debug flag is set to true