AppStates refactoring