Work on state machine