improved download script