refactor splitByKey