Replace some debug output with debug handler class.