added temp file input and output