Made further changes to isConnected