data tidying script + output text file