refactored the EditDistance trait
refactored the EditDistance trait