Text output refactoring