Added kdTree implementation