moved temp file to global variable