     
     @discardableResult public func registerOnError(_ block:
         @escaping (Error) -> Void) -> Promise<Void> {
-        let p = Promise<Void> { [weak self] resolve, reject, progress in
-            if let state = self?.state {
-                switch state {
-                case .fulfilled:
-                    reject(NSError(domain: "", code: 123, userInfo: nil))
-                // No error so do nothing.
-                case let .rejected(error):
-                    // Already failed so call error block
-                    block(error)
-                    resolve()
-                case .pending:
-                    // if promise fails, resolve error promise
-                    self?.failBlocks.append({ e in
-                        block(e)
-                        resolve()
-                    })
-                    self?.successBlocks.append({ t in
-                        resolve()
-                    })
-                }
-            }
-            self?.progressBlocks.append(progress)
-        }
+        let p = Promise<Void>()
+        switch state {
+        case .fulfilled:
+            p.rejectPromise(NSError(domain: "", code: 123, userInfo: nil))
+        // No error so do nothing.
+        case let .rejected(error):
+            // Already failed so call error block
+            block(error)
+            p.resolvePromise()
+        case .pending:
+            // if promise fails, resolve error promise
+            failBlocks.append({ e in
+                block(e)
+                p.resolvePromise()
+            })
+            successBlocks.append({ t in
+                p.resolvePromise()
+            })
+        }
+        progressBlocks.append(p.progressPromise)
         p.start()
         passAlongFirstPromiseStartFunctionAndStateTo(p)
         return p

    }
    
    public func registerProgress(_ block: @escaping (Float) -> Void) -> Promise<Void> {
        let p = Promise<Void> { [weak self] resolve, reject, progress in
            if let state = self?.state {
                switch state {
                case .fulfilled:
                    resolve()
                case let .rejected(error):
                    reject(error)
                case .pending:()
                self?.failBlocks.append(reject)
                self?.successBlocks.append({ _ in
                    resolve()
                })
                }
            }
            self?.progressBlocks.append({ p in
                block(p)
                progress(p)
            })
        }
        p.start()
        passAlongFirstPromiseStartFunctionAndStateTo(p)
        return p

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