improved get_distance() function, implemented simple test case