Added waitForText method