Refactor debug text display