adding edit distance function