new version of kd tree