Refactored module loader.