Improved the task queue management.