loader refactoring