added get distance function