Refactor downloading to a separate class