Add a sortAndSplit method.