refactoring string generator