Better splitting algorithm.