add state_machine class.