shorter variable names and maxMinDistance optimization in KNN