 }
 
 typealias LayoutParam = Dictionary<NSLayoutAttribute, CGFloat>
+typealias Rule = (UIView, SizeClassPair, LayoutParam)
 
 class LayoutManager: NSObject {
-    var hierarchy2 = [(UIView, SizeClassPair, LayoutParam)]()
+    var hierarchy = [Rule]()
     let owner:UIView
     let type:LayoutType
     init(view: UIView) {

                    constant: param[key]!)
            } else {
                if (key == .Top && type == .Vertical) || (key == .Left && type == .Horizontal) {
                    let rule:(UIView, SizeClassPair, LayoutParam)? = rulesContainedBySize(size).last
                    var previousView:UIView? = nil
                    if rule == nil || rule!.0 == view {
                        previousView = owner

    }

    private func rulesContainSize(currentSize: SizeClassPair) -> [(UIView, SizeClassPair, LayoutParam)] {
        return hierarchy.filter({(_, size, _) in return currentSize.contains(size)})
    }
    private func rulesContainedBySize(currentSize: SizeClassPair) -> [(UIView, SizeClassPair, LayoutParam)] {
        return hierarchy.filter({(_, size, _) in return size.contains(currentSize)})
    }
    
    private func constraintsWithLayoutParam(param: LayoutParam, view:UIView, size:SizeClassPair) -> [NSLayoutConstraint] {
        var result:[NSLayoutConstraint] = []

        for key in param.keys {
