start kd-tree implementation