do_flow -> run_state_machine; more generalized