final version with file download