improve Edit Distance