add distance function.