Enhanced functionality to provide a temporary path to the downloaded file, and fixed a few edge cases.