changed debug mode to output to the console