Added closing bracket to distance function