Move download functionality to a separate module and test it.