fist code for export functionality