Refactor string split