A significant refactoring to support lazy loading of resource states.