refactor - move code for edit distance to separate file.