Improves the testing and structure of the state definitions