Updated state machine