Implemented get_distance() function