extract file creation to method