Generate a CSV correctly