Added generation of file as necessary