added checks for Levenshtein distance