Code cleanup in TasksQueue