added option for async or sync downloading