updated download function
updated download function