Use tempfiles instead of PIPE