refactor string funcs