rewrite of string handling