Optimized split algorithm.