Refactoring of split method