       return responseIsValid
     }
     
-    private func dataReceived(data : NSData!, response : NSURLResponse!, error : NSError!, failure fail : ((NSError?) -> Void), success succeed : (NSData) -> Void) {
+    private func dataReceived(data : NSData!, response : NSURLResponse!, error : NSError!, failure fail : ((NSError?,Request) -> Void), success succeed : (NSData,Request) -> Void) {
       if let error = error {
         if error.domain != NSURLErrorDomain || error.code != NSURLErrorCancelled {
           dispatch_async(dispatch_get_main_queue(), {
-            fail(error)
+            fail(error,self)
           })
         }
       } else if let httpResponse = response as? NSHTTPURLResponse {

  public func get(key: KeyType) -> CacheRequest<OutputType> {
    let result = CacheRequest<OutputType>()
    
    let request = Request(URL: key, success: { data in
      Logger.log("Fetched \(key) from the network fetcher")
      result.succeed(data)
      self.pendingRequests[key.absoluteString!] = nil
    }, failure: { error in
      Logger.log("Failed fetching \(key) from the network fetcher", .Error)
      result.fail(error)
      self.pendingRequests[key.absoluteString!] = nil
    })
    
    pendingRequests[key.absoluteString!] = request
    return result
  }
  

      }
    }
    
    private func failWithCode(code: NetworkFetcherError, failure fail : ((NSError?,Request) -> ())) {
      dispatch_async(dispatch_get_main_queue()) {
        fail(errorWithCode(code.rawValue),self)
      }
    }
  }

  private lazy var lockQueue: dispatch_queue_t = {
    return dispatch_queue_create(CarlosGlobals.QueueNamePrefix + "NetworkFetcher", nil)
  }()

  private var pendingRequests: [Request] = []

  private func addPendingRequest(request: Request) {
    dispatch_async(lockQueue) {
      self.pendingRequests.append(request)
    }
  }

  private func removePendingRequests(request: Request) {
    dispatch_async(lockQueue) {
      var idx: Int?

      for (index, obj) in enumerate(self.pendingRequests) {
        if request === obj {
          idx = index
          break
        }
      }

      if let idx = idx {
        self.pendingRequests.removeAtIndex(idx)
      }
    }
  }

  /**
  Initializes a new instance of a NetworkFetcher
  */
