move download to earlier in script