Creation of files from templates moved to generic function