added functionality to clear the temporary directory