Use tempfile to avoid name conflicts