adding kd tree changes