setting up kd tree