move findAndDequeueTaskFromList to the inside of findAndDequeueTask