     }
     
     @discardableResult public func registerThen<X>(_ block: @escaping (T) -> X) -> Promise<X> {
-        let p = Promise<X> { [weak self] resolve, reject, progress in
-            if let state = self?.state {
-                switch state {
-                case let .fulfilled(value):
-                    let x: X = block(value)
-                    resolve(x)
-                case let .rejected(error):
-                    reject(error)
-                case .pending:
-                    self?.successBlocks.append({ t in
-                        resolve(block(t))
-                    })
-                    self?.failBlocks.append(reject)
-                    self?.progressBlocks.append(progress)
-                }
-            }
+        let p = Promise<X>()
+        switch state {
+        case let .fulfilled(value):
+            let x: X = block(value)
+            p.resolvePromise(x)
+        case let .rejected(error):
+            p.rejectPromise(error)
+        case .pending:
+            successBlocks.append({ t in
+                p.resolvePromise(block(t))
+            })
+            failBlocks.append(p.rejectPromise)
+            progressBlocks.append(p.progressPromise)
         }
         p.start()
         passAlongFirstPromiseStartFunctionAndStateTo(p)

    var initialPromiseStart:(() -> Void)?
    var initialPromiseStarted = false
    
    public init(callback: @escaping (_ resolve: @escaping ResolveCallBack,
        _ reject: @escaping RejectCallBack) -> Void) {
        promiseCallBack = callback

    }
    
    @discardableResult public func registerFinally<X>(block: @escaping () -> X) -> Promise<X> {
        let p = Promise<X>()
        switch state {
        case .fulfilled:
            p.resolvePromise(block())
        case .rejected:
            p.resolvePromise(block())
        case .pending:
            failBlocks.append({ e in
                p.resolvePromise(block())
            })
            successBlocks.append({ t in
                 p.resolvePromise(block())
            })
        }
        progressBlocks.append(p.progressPromise)
        p.start()
        passAlongFirstPromiseStartFunctionAndStateTo(p)
        return p
