Changes to computeDistances and getBestClass.