Added waitForConnected()