now writes the name to the csv file as well