Abstract download functionality to a separate method