Coded around 2d+ limitation in KDTree