Added nearest neighbour search for kd tree