updating lev distance for sort