 
     public func flatMap<M>(executionContext:ExecutionContext, mapping:T -> Future<M>) -> Future<M> {
         let promise = Promise<M>()
+        self.onComplete(executionContext) {result in
+            switch result {
+            case .Success(let resultWrapper):
+                promise.completeWith(mapping(resultWrapper.value))
+            case .Failure(let error):
+                promise.failure(error)
+            }
+        }
+        return promise.future
+    }
+    
+    public func recover(recovery:NSError -> Try<T>) -> Future<T> {
+        return self.recover(QueueContext.main, recovery:recovery)
+    }
+    
+    public func recover(executionContext:ExecutionContext, recovery:NSError -> Try<T>) -> Future<T> {
+        let promise = Promise<T>()
+        self.onComplete(executionContext) {result in
+            switch result {
+            case .Success(let resultWrapper):
+                promise.success(resultWrapper.value)
+            case .Failure(let error):
+                promise.complete(recovery(error))
+            }
+        }
         return promise.future
     }
     
     internal init() {
     }
     
-    internal func completeWith(future:Future<T>) {
+    internal func write(future:Future<T>) {
         if future.isCompleted == false {
             future.failure(NSError(domain:SimpleFuturesError.domain,
                 code:SimpleFuturesError.FutureNotCompleted.code,

    public func succes(value:T) {
        let promise = Promise<T>()
        promise.success(value)
        self.completeWith(promise.future)
    }
    
    public func failure(error:NSError) {
        let promise = Promise<T>()
        promise.failure(error)
        self.completeWith(promise.future)
    }
    
    public func completeWith(future:Future<T>) {
        self.futureStream.completeWith(future)
    }
    


        }
    }
    
    public func map<M>(mapping:T -> Try<M>) -> Future<M> {
        return self.map(QueueContext.main, mapping)
    }
    
    public func map<M>(executionContext:ExecutionContext, mapping:T -> Try<M>) -> Future<M> {
        let promise = Promise<M>()
        self.onComplete(executionContext) {result in
            switch result {
            case .Success(let resultWrapper):
                promise.complete(mapping(resultWrapper.value))
            case .Failure(let error):
                promise.failure(error)
            }
        }
        return promise.future
    }
    
