     private var advertisingTimeoutTimer: NSTimer?
     private var connectionTimeoutTimer: NSTimer?
     private var connectionAttempt = 0
+    private var didInitiateConnection = false
 
     /// Convenience initializer that takes a BLEDiscoveryManager instead of a CBCentralManager. This initializer allows to detect that the device has disappeared by checking if the OS didn't receive any more advertising packages.
     public convenience init(discoveryManager: BLEDiscoveryManager, uuid: String, peripheral: CBPeripheral) {

        #endif
        advertisingTimeoutTimer?.invalidate()
        centralManager.connectPeripheral(peripheral, options: nil)
        connectionTimeoutTimer?.invalidate()
        connectionTimeoutTimer = NSTimer.scheduledTimerWithTimeInterval(self.dynamicType.connectionTimeoutInterval, target: self, selector: #selector(self.didConnectTimeout), userInfo: nil, repeats: false)
        connectionAttempt += 1

    }

    public func disconnect() -> Bool {
        // Only disconnect if connection was initiated by this instance. BLEDevice can also be used to only discover peripherals but somebody else takes then ownership over the `delegate` instance.
        guard didInitiateConnection && [CBPeripheralState.Connecting, CBPeripheralState.Connected].contains(peripheral.state) else { return false }
        centralManager.cancelPeripheralConnection(peripheral)
        return true
    }
