Reduce the state machine