refactor download manager