set states last to minimize rancing coniditions