refactor to use split instead of lines