Refactor string handling.