Issue #79
Fixing distance calculation problem