kdtree working