Bug fix (for DistanceUpdateMode.MIN), and code clean-up.