refactoring formatStrings()