loop through tasks until none left