did state machine