refactoring resource loaders