Deal with state changes in a more consistent manner

Boo...regex find/replace did that.