Added logging information and the generation of unique filenames.