Moved StateMachine to it's own sub module.