Copy our distance function