Added state manager as well as a basis for the states.