Add external scope and check for modules
Correct module exporting