refactor functions that make downloads, added download functions