Optimize the export script