refactored exporting mechanism