Added a bunch of code in support of the state transition architecture.
The code doesn't currently compile.