modified not to use tem file