Added state machines.
More stuff.