Refactor debug output.