add while loop to keep assigning tasks