refactor splitn