Created common structure for state machines

Fixes #66 

By having a common structure for all state machines, the implementation
of the structure can change without having to change all the state
machine implementations and state machine builder implementations.  This
also hides the exact implementation from the state machine and builders.