Add distance functions

Will likely need to use some, if not all, of these distance functions.
Tested with a few sample cases.