Finished reworking of the splitting algorithm now in both ways