working on fsm