documentation for state machine