code to export to txt added