Added generate_filenames function.