tweaked formula for distance between activities