appendString refactoring