Refactored exports. Now depends on global for tests.