         currentAck += 1
 
         return {[weak self, ack = currentAck] timeout, callback in
-            if let this = self {
-                dispatch_sync(this.ackQueue) {
-                    this.ackHandlers.addAck(ack, callback: callback)
-                }
-
+            guard let this = self else { return }
+            
+            dispatch_sync(this.ackQueue) {
+                this.ackHandlers.addAck(ack, callback: callback)
+            }
+            
+            
+            this._emit(items, ack: ack)
+            
+            if timeout != 0 {
+                let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeout * NSEC_PER_SEC))
                 
-                this._emit(items, ack: ack)
-
-                if timeout != 0 {
-                    let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeout * NSEC_PER_SEC))
-
-                    dispatch_after(time, this.ackQueue) {
-                        this.ackHandlers.timeoutAck(ack, onQueue: this.handleQueue)
-                    }
+                dispatch_after(time, this.ackQueue) {
+                    this.ackHandlers.timeoutAck(ack, onQueue: this.handleQueue)
                 }
             }
         }

        return nsp + "#" + (engine?.sid ?? "")
    }
    
    /// Type safe way to create a new SocketIOClient. opts can be omitted
    public init(socketURL: NSURL, config: SocketIOClientConfiguration = []) {
        self.config = config
        self.socketURL = socketURL


    /// Disconnects the socket.
    public func disconnect() {
        DefaultSocketLogger.Logger.log("Closing socket", type: logType)

        didDisconnect("Disconnect")
