Refactored debug message placement.