Added additional parameter to ProcessTasks which is the size of the tasks array.