encapsulated nfa to dfa conversion and major bug fixing