Moved the debugging code to the class Debug