Added a state machine.