I cannot think of a simpler solution of this kind of splitting function.