refactor string handling