begin kd tree