separate download function