renamed computeDistance to compute