Pulled in the right distance functions from the patstat branch