dfa implementation added.