refactor text output