Working state machine