Refactoring on the debug module