         
         self.onFulfilled(value)
     }
-/*
-    func resolve(#promise: Promise)
+
+    func resolve<T: Thenable where T.ValueType == V, T.ReasonType == NSError>(#thenable: T)
     {
         if self.state != .Pending {
             return
         }
-
-        if promise === self {
-            self.onRejected(NSError.aPlusPromiseTypeError())    // TODO: Replace aPlusPromiseTypeError
-        }
-        else {
-            promise.then(
-                onFulfilled: { (value) -> Void in
-                    self.onFulfilled(value)
-                },
-                onRejected: { (reason) -> Void in
-                    self.onRejected(reason)
-                }
-            )
-        }
-    }
-    */
-    
-    func resolve<T: Thenable where T.ValueType == V, T.ReasonType == NSError>(#thenable: T)
-    {
-        if self.state != .Pending {
-            return
+        
+        if let promise = thenable as? Promise<V> {
+            if promise === self {
+                self.onRejected(NSError.aPlusPromiseTypeError())    // TODO: Replace aPlusPromiseTypeError
+            }
         }
         
         thenable.then(

        
        return subPromise
    }

    public func catch(
        onRejected: (reason: NSError) -> Void
        ) -> Self
    {
        return self.then(onFulfilled: nil, onRejected: onRejected)
    }


    public func then<N, T: Thenable where T.ValueType == N, T.ReasonType == NSError>(
        onFulfilled: (value: V) -> T,
        onRejected: (reason: NSError) -> T
        ) -> Promise<N>
    {
        let subPromise = Promise<N>()
        
        
        return subPromise
    }
}
        
        return subPromise
    }
    /*
    public func then<N>(
        #onFulfilled: (value: V) -> Promise<N>,
        onRejected: (reason: NSError) -> Promise<N>
