         }
         let timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
         CATransaction.setAnimationTimingFunction(timing)
-        progressLayer.strokeStart = 0
         progressLayer.strokeEnd = self.progress
         CATransaction.commit()
     }

    var progressLayer = CAShapeLayer()
    
    @IBInspectable var progress: CGFloat = CGFloat(0)
   
    @IBInspectable var color: NSColor = NSColor.whiteColor() {
        didSet {
            backgroundCircle.strokeColor = color.colorWithAlphaComponent(0.5).CGColor

    func makeLayers() {
        self.wantsLayer = true
        let rect = self.bounds
        let radius = (rect.width / 2) * 0.75

        func addBackgroundLayer(rect: NSRect) {
            let radius = NSWidth(rect) * 0.1
            backgroundLayer.frame = rect
            backgroundLayer.fillColor = backgroundColor.CGColor
            var backgroundPath = NSBezierPath(roundedRect: rect, xRadius: radius, yRadius: radius)
            backgroundLayer.path = backgroundPath.CGPath
            self.layer?.addSublayer(backgroundLayer)
        }
        
        func addBackgroundCircle() {
            backgroundCircle.frame = rect
            backgroundCircle.strokeColor = color.colorWithAlphaComponent(0.5).CGColor
            backgroundCircle.fillColor = NSColor.clearColor().CGColor
            var backgroundPath = NSBezierPath()
            backgroundPath.appendBezierPathWithArcWithCenter(rect.center(), radius: radius, startAngle: 0, endAngle: 360)
            backgroundCircle.path = backgroundPath.CGPath
            self.layer?.addSublayer(backgroundCircle)
        }
        
        func addProgressLayer(rect: NSRect, radius: CGFloat) {
            progressLayer.strokeStart = 0 //REMOVe this
            progressLayer.strokeEnd = 0 //REMOVe this
            progressLayer.fillColor = NSColor.clearColor().CGColor
            progressLayer.lineCap = kCALineCapRound
            
            progressLayer.frame = rect
            progressLayer.strokeColor = color.CGColor
            var arcPath = NSBezierPath()
            var startAngle = CGFloat(90)
            arcPath.appendBezierPathWithArcWithCenter(rect.center(), radius: radius, startAngle: startAngle, endAngle: (startAngle - 360), clockwise: true)
            progressLayer.path = arcPath.CGPath
            self.layer?.addSublayer(progressLayer)
        }

        addBackgroundLayer(rect)
        addBackgroundCircle()
        addProgressLayer(rect, radius)
    }
}

