Refactoring module loading