updated editDistance