Correct getDistance method.