Reverted change to distance computation