adding an option to specify a scratch folder for the intermediate products