refactor for text format