changes for distance calculation