separate download function from tests (#633)