refactor levenshtein.