Had to refactor a bit to make it work properly; state.StateEngine now drives consumption and state selection on whatever state machine chooses to use it, and provides an interface defining the functions that are required by the state machine.