     }
     
     func centralManager(central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: NSError?) {
-        statusLabel.string = (connectedPeripheral?.name ?? "") + ":\n disconnected"
-        connectedPeripheral = nil
-        //TODO: update view to reflect the peripheral disconnected
+        if let connectedPeripheral = connectedPeripheral {
+            statusLabel.string = (connectedPeripheral.name ?? "") + ":\n disconnected"
+        } else {
+            statusLabel.string = ""
+        }
     }
     
     func centralManagerDidUpdateState(central: CBCentralManager) {}

extension ViewController : CBPeripheralDelegate {
    func peripheral(peripheral: CBPeripheral, didDiscoverServices error: NSError?) {
        browser.reloadColumn(1)
    }
    
    func peripheral(peripheral: CBPeripheral, didDiscoverCharacteristicsForService service: CBService, error: NSError?) {
        browser.reloadColumn(2)
    }
    
    func peripheral(peripheral: CBPeripheral, didUpdateValueForCharacteristic characteristic: CBCharacteristic, error: NSError?) {

        let indexPath = browser.selectionIndexPath
        let column = indexPath.length
        browser.setTitle(self.browser(browser,titleOfColumn:column)!, ofColumn: column)
        // Automatically reconnect if a service or characteristic is selected.
        if [2,3].contains(indexPath.length) {
            reconnectPeripheral()
        }
        if indexPath.length == 1 {
            let peripheral = scanner.devices[indexPath.indexAtPosition(0)]
            if peripheral != connectedPeripheral {
