switched to kd tree