Working version of FSM tutorial