Added reuseable waitFor() method.