flattened the structure of the state machine