State, StateMachine classes.

+Moved large amounts of code from main to State.