     
     func right(points:CGFloat) -> UIView {
         if let spv = superview {
-            let c = NSLayoutConstraint(item: self, attribute: .Right, relatedBy: .Equal, toItem: spv, attribute: .Right, multiplier: 1, constant: -points)
+            let c = constraint(item: self, attribute: .Right, toItem: spv, constant: -points)
             spv.addConstraint(c)
         }
         return self

    
    func top(points:CGFloat) -> UIView {
        if let spv = superview {
            let c = NSLayoutConstraint(item: self, attribute: .Top, relatedBy: .Equal, toItem: spv, attribute: .Top, multiplier: 1, constant: points)
            spv.addConstraint(c)
        }
        return self

    }
}

func constraint(item view1: AnyObject,
    attribute attr1: NSLayoutAttribute,
    relatedBy: NSLayoutRelation = .Equal,
    toItem view2: AnyObject? = nil,
    attribute attr2: NSLayoutAttribute? = nil, // Not an attribute??
    multiplier: CGFloat = 1,
    constant: CGFloat = 0) -> NSLayoutConstraint {
        return NSLayoutConstraint(item: view1, attribute: attr1, relatedBy: relatedBy, toItem: view2, attribute: ((attr2 == nil) ? attr1 : attr2! ), multiplier: multiplier, constant: constant)
}

// MARK: - Alignment

func alignHorizontally(v1:UIView, with v2:UIView) {
    if let spv = v1.superview {
        let c = constraint(item: v1, attribute: .CenterY, toItem: v2)
        spv.addConstraint(c)
    }
}
