added in some distance functionality