initial distance calculations