implemented functional automaton-flow.