improving haversine and adding tests