putting kdtree back in