Added distance calculation.