     func setupGlossLayer() -> CALayer {
         let gloss = CALayer()
 
-        let image = NSImage(named: "Gloss")
-        let imageSource = CGImageSourceCreateWithData(image?.TIFFRepresentation, nil)
-        let glossyImage = CGImageSourceCreateImageAtIndex(imageSource, 0, nil)
+        if let image = NSImage(named: "Gloss") {
+            gloss.contents = image.CGImage
+        }
 
-        gloss.contents = glossyImage
         gloss.opacity = 0.8
         gloss.cornerRadius = 12.0
         gloss.masksToBounds = true

    func setupBorderLayer() -> CALayer {
        let border = CALayer()

        let borderRect = CGRectInset(frame, 8.0, 8.0)

        border.cornerRadius = 12.0
        border.borderColor = NSColor.whiteColor().CGColor
        border.borderWidth = 2.0

        border.frame = borderRect

        return border
    }

    attribute2: CAConstraintAttribute) -> CAConstraint {
        return CAConstraint.constraintWithAttribute(attribute, relativeTo: "superlayer", attribute: attribute2) as! CAConstraint
}

extension NSImage {
    var CGImage: CGImageRef {
        let imageSource = CGImageSourceCreateWithData(self.TIFFRepresentation, nil)
        return CGImageSourceCreateImageAtIndex(imageSource, 0, nil)
    }
}