2 state machine works