fsm to state machine