Separation of points is incorrect
When initialising the KDTree I split the points by sorting and splitting at the midpoint. The idea is that the left child gets records <= the median, the right gets everything > the median.
The current approach is wrong and could lead to values == the median going to the right child. I need to increment the split index until it is > the median.