Replacing ResourceManager, refactoring of states