State Machine.