changed parameter name in checkDistanceAndUpdateBest()