Refactor StateChanges into a tree of IStageChange providers - fixes 361

Fixes #361.
I guess these are implemented in the followup branch.