update state machine code examples