refactor the string handler