Major cleanup for module loading.