refactor download.