Some commenting and cleanup happened in the state machine.