Updated KDTree to evaluate nearest neighbor