refactoring resource manager