changed downloadData to use lapply instead of loop