added first distance calculations.