made the code support correctly setting the "is_primary" flag.
adding batch download support.