refactored export-thread