Added parameter max_distance to Levenshtein to allow algorithm return faster when only a distance comparision is needed