Features/formalize state machine integration