better testing file and removal of temp files