     }
     
     func monitor(peer : MCPeerID) -> Receive {
-        print("monitor")
-        return {[unowned self] (msg : Message) in
+        return {[unowned self] (msg : Message) in
+            print("monitor")
             switch(msg) {
                 case is OnFrame:
                     print("ignoring frame")
                     break
                 case let m as AddMonitor:
                     print("adding monitor")
-                    self.become(self.monitorWithMonitor(m.sender!))
-                    break
+                    self.become(self.monitorWithMonitor(m.sender!, peer: peer))
+                    break
+                
                 case is UnbecomeMonitor:
                     self.unbecome()
                     break
+                
+                case let c as DisconnectPeer:
+                    if (c.peer.displayName == peer.displayName) {
+                        self.unbecome()
+                        self.this ! c
+                    }
+                    break
+                
                 case is Disconnect:
                     self.unbecome()
                     self.this ! msg

                case let c as DisconnectPeer:
                    if (c.peer.displayName == peer.displayName) {
                        self.unbecome()
                    }
                    break
                

    
    
    func scanning(lobby : LobbyViewController) -> Receive {
        return {[unowned self] (msg : Message) in
            print("Scanning")
            switch(msg) {
                case is StartScanning:
                    ^{
                        lobby.navigationController?.popToViewController(lobby, animated: true)
                    }
                    self.session = MCSession(peer: self.peerID)
                    self.session.delegate = self
                    ^{
                        let browser = MCBrowserViewController(serviceType: self.service, session: self.session);
                        browser.delegate = self;
                        browser.minimumNumberOfPeers = 2
                        browser.maximumNumberOfPeers = 2
                        browser.modalPresentationStyle = UIModalPresentationStyle.FormSheet
                        self.mcAdvertiserAssistant = MCAdvertiserAssistant(serviceType: self.service, discoveryInfo: nil, session: self.session)
                        self.mcAdvertiserAssistant.start()
                        lobby.presentViewController(browser, animated: true, completion: { () -> Void in
                            
                        })
                    }

                    break
                case let w as OnConnectToDevice:
                    self.become(self.connected(lobby, peer: w.peer))
                    self.mcAdvertiserAssistant.stop()
                    break
                case is Disconnect:
