refactoring resources tree handling