Added state machine class, subordinate classes, and unit test.