Text refactoring