refactored download