Fsm cleanup