refactoring download a bit