Tweaking file download logic