kd_tree implemented