made the appropriate fixes to edit distance