added some distance algorithms