added file download logic