add state machine