refactored construct nfa page and the jsflap library