                     return false
                 }
                 
-                dispatch_async(queue,{ [weak self] in
+                dispatch_async(queue) { [weak self] in
                     guard let s = self else { return }
-                    if let textBlock = s.onText {
-                        textBlock(str! as String)
-                    }
+                    s.onText?(str! as String)
                     s.delegate?.websocketDidReceiveMessage(s, text: str! as String)
-                    })
+                }
             } else if response.code == .BinaryFrame {
                 let data = response.buffer! //local copy so it is perverse for writing
-                dispatch_async(queue,{ [weak self] in
+                dispatch_async(queue) { [weak self] in
                     guard let s = self else { return }
-                    if let dataBlock = s.onData {
-                        dataBlock(data)
-                    }
+                    s.onData?(data)
                     s.delegate?.websocketDidReceiveData(s, data: data)
-                    })
+                }
             }
             readStack.removeLast()
             return true

            }
        }
        if eventCode == .HasBytesAvailable {
            if(aStream == inputStream) {
                processInputStream()
            }
        } else if eventCode == .ErrorOccurred {

        }
        if totalSize > 0 {
            if validateResponse(buffer, bufferLen: totalSize) {
                dispatch_async(queue) { [weak self] in
                    guard let s = self else { return }
                    s.onConnect?()
                    s.delegate?.websocketDidConnect(s)
                }
                totalSize += 1 //skip the last \n
                let restSize = bufferLen - totalSize
                if restSize > 0 {
