Refactor code in Strings