Implement use and delete of tempfiles