Resolves issue #8446
Using an OrderedDict for the state resolves the issue where states are not applied in the order they are defined