Added a different distance function signature