changed download logic