Updated edit_distance