export: move common duplicated bits to functions/export.