Added WaitForData method.