impove the implementation of the wating function. Now we replace rolling as a queue to check if the jobs are finished.