 
 public class Promise<T> : Synchronizable {
     public let synchronizationQueue: DispatchQueue
-    private var state: State = .Pending
-    private var result: Result<T>? = nil
-    private var parent: (() -> Any)? = nil
-    private var onFulfilled: Array<(T) -> ()>! = []
-    private var onRejected: Array<(Error) -> ()>! = []
+    private var state: State<T>
     
     public init(_ resolver: (fulfill: T -> (), reject: Error -> (), isCancelled: () -> Bool) -> ()) {
-        self.parent = nil
+        self.state = .Pending(PendingInfo())
         self.synchronizationQueue = GCDQueue.serial("net.franticapparatus.Promise")
         
         let weakFulfill: T -> () = { [weak self] value in

                        }
                        return reasonResult
                    }
                ))
            }
        default:
            return

    }
}

private class PendingInfo<T> {
    let parent: (() -> Any)?
    var deferred: Promise<T>? = nil
    var onFulfilled: Array<T -> ()> = []
    var onRejected: Array<Error -> ()> = []
    
    private init() {
        self.parent = nil
    }

    private init(parent: () -> Any) {
        self.parent = parent
    }
}

private enum State<T> {
    case Pending(PendingInfo<T>)
    case Fulfilled(Value<T>)
    case Rejected(Error)
}

public enum Result<T> {
