     }
 
     // MARK: Methods to be overridden by subclass
+    //TODO: Implement as delegate methods. This class should not required to be sub classed.
 
     public func deviceWithPeripheral(peripheral: CBPeripheral) -> BLEDevice? {
         return nil

        lastUnreachableDevicesRemovedTimestamp = NSDate()

        // All bluetooth devices found during the *previous* discovery session and not found during the currently running discovery session will assumed to be now unreachable
        previouslyDiscoveredDevices.filter { previouslyDiscoveredController -> Bool in
            return (previouslyDiscoveredController.peripheral.state == .Disconnected) &&
                (currentlyDiscoveredDevices.filter{$0.uuid == previouslyDiscoveredController.uuid}).count == 0
            }.forEach(discovery.invalidateDevice)

        // Rescan peripherals
        previouslyDiscoveredDevices = currentlyDiscoveredDevices

    }

    @objc func centralManagerDidUpdateState(central: CBCentralManager) {
        switch central.state {
        case .PoweredOn:
            // When bluetooth turned on and discovery start had already been triggered before, start discovery now
            guard shouldStartDiscoveryWhenPowerStateTurnsOn else { break }
            discovery.startDiscovery(discoverServiceUUIDs, detectUnreachableControllers: detectUnreachableControllers)
        case .PoweredOff:
            break
        default:
            // Invalidate all connections as state moved below .PoweredOff
            deviceForPeripheral.values.forEach(invalidateDevice)
        }
    }
