added edit-distance ordering