Added the file generator logic