     
     public override func didConnect() {
         super.didConnect()
-        isWaitingForMatrixWriteResponse = false
-        writeMatrixOnWriteResponseReceived = false
+        matrixWriter = nil
         delegate?.nuimoControllerDidConnect?(self)
     }
     

    public var state: NuimoConnectionState { get{ return self.peripheral.state.nuimoConnectionState } }
    public var batteryLevel: Int = -1 { didSet { if self.batteryLevel != oldValue { delegate?.nuimoController?(self, didUpdateBatteryLevel: self.batteryLevel) } } }
    public var defaultMatrixDisplayInterval: NSTimeInterval = 2.0
    public var matrixBrightness: Float = 1.0
    public var firmwareVersion = 0.1
    
    public override var serviceUUIDs: [CBUUID] { get { return nuimoServiceUUIDs } }
    public override var charactericUUIDsForServiceUUID: [CBUUID : [CBUUID]] { get { return nuimoCharactericUUIDsForServiceUUID } }
    public override var notificationCharacteristicUUIDs: [CBUUID] { get { return nuimoNotificationCharacteristicnUUIDs } }

    private var matrixCharacteristic: CBCharacteristic?
    private var currentMatrix: NuimoLEDMatrix?
    private var currentMatrixDisplayInterval: NSTimeInterval = 0.0
    private var isWaitingForMatrixWriteResponse: Bool = false
    private var writeMatrixOnWriteResponseReceived: Bool = false
    private var writeMatrixResponseTimeoutTimer: NSTimer?
    
    public override func connect() {
        super.connect()

            writeMatrixNow()
        }
    }

    func writeMatrixNow() {
        guard let currentMatrix = self.currentMatrix where !isWaitingForMatrixWriteResponse else { return }

        // Convert matrix string representation into byte representation
        let matrixBytes = currentMatrix.matrixBytes

        // Write matrix
        let matrixData = NSMutableData(bytes: matrixBytes, length: matrixBytes.count)
        if firmwareVersion >= 0.1 {
            let matrixAdditionalBytes: [UInt8] = [UInt8(min(max(brightness, 0.0), 1.0) * 255), UInt8(currentMatrixDisplayInterval * 10.0)]
            matrixData.appendBytes(matrixAdditionalBytes, length: matrixAdditionalBytes.count)
        }
        peripheral.writeValue(matrixData, forCharacteristic: matrixCharacteristic, type: .WithResponse)
        isWaitingForMatrixWriteResponse = true

        // When the matrix write response is not retrieved within 100ms we assume the response to have timed out
        writeMatrixResponseTimeoutTimer?.invalidate()
        writeMatrixResponseTimeoutTimer = NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: "didRetrieveMatrixWriteResponse", userInfo: nil, repeats: false)
    }

    @objc func didRetrieveMatrixWriteResponse() {
        isWaitingForMatrixWriteResponse = false
        writeMatrixResponseTimeoutTimer?.invalidate()

        // Write next matrix if any
        if writeMatrixOnWriteResponseReceived {
            writeMatrixOnWriteResponseReceived = false
