     fileprivate func connect(peerWithId peerId: UUID) {
         Clink.Configuration.dispatchQueue.async {
             if
-                let i = self.connectedPeers.index(where: { $0.id == peerId }),
-                let peripheral = self.connectedPeers[i].peripheral,
-                peripheral.state == .connected
+                let i = self.activePeripherals.index(where: { $0.identifier == peerId }),
+                self.activePeripherals[i].state == .connected
             {
                 return
             }

    {
        if error != nil { self.publish(notification: .error(.unknownError)) }
        
        if let i = self.connectedPeers.index(where: { $0.id == peripheral.identifier }) {
            let peer = self.connectedPeers[i]
            
            self.connectedPeers.remove(at: i)
            
            self.publish(notification: .disconnected(peer))
        }
        

        }
    }
    
    public func getSavedPeer(withId peerId: UUID) -> ClinkPeer? {
        guard let peerDict = UserDefaults.standard.dictionary(forKey: peerId.uuidString) else { return nil }
        
        return ClinkPeer(dict: peerDict)
    }
    
    public func getSavedPeers() -> [ClinkPeer] {
        return (UserDefaults.standard.stringArray(forKey: savedPeerIdsDefaultsKey) ?? []).flatMap { uuidString in
            guard let uuid = UUID(uuidString: uuidString) else { return nil }
            
