new fsm code