Add distance calculation and tests.
Merge remote-tracking branch 'origin/master'