begin fsm.h cod