Task counter (NumberOfTasks) added to relevant functions