created distance calculation functions and tests.