refactore the functions to download, save and delete files