initial fsm code
current code