Refactoring on debug messages