Factor out distance.