Organized output into debug and error msgs.
Print debug output only if debug mode enabled.