added waitForJobs in examples