added iteration in haversine function