functionality for downloading files