function to export