Added haversine function

Distances are now correctly calculated using haversine distances, rather
than cartesian distances.

This implements #12