added some distance functions