correct unique filenames for everything & removal of temporary files