Implentation of Kdtree search