refactor download