refactored, can get geodetic distance as well