Moved all countDistances function calls to classify step.