WaitForActivities method added.