Rewrote the state definitions.