Generating a file and writing one are  now separated