Fix bug; add valgrind; remove edit distance (broken)