internal state machine update