changed formula for distance computation (testing purposes)