         advertisementData: [String : Any],
         rssi RSSI: NSNumber)
     {
-        
-        if remotePeripheral == nil {
+        if remotePeripheral == nil, peripheral.state == .disconnected {
             remotePeripheral = peripheral
             status = .discoveredRemotePeer
             

    public func peripheralManagerIsReady(toUpdateSubscribers peripheral: CBPeripheralManager) {
        status = Status(rawValue: status.rawValue)!
    }
}


            let characteristics = service.characteristics,
            let characteristic = characteristics.first(where: { $0.uuid == pairingStatusCharacteristic.uuid })
        {
            peripheral.readValue(for: characteristic)
            peripheral.setNotifyValue(true, for: characteristic)
        }
    }
    
    public func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
        guard error == nil else { return print(error) }
        
        if
            peripheral.identifier == remotePeripheral?.identifier,
            characteristic.uuid == pairingStatusCharacteristic.uuid,
