Added waitForConnected