Added a distance function

This new function is the bees knees!