Added a way to calculate distances.