a very rough sketch of how we might want to implement the state machine