Corrected memory leakage in build_dfa. Complete dfa is much faster. Implemented reverse DFA as well.