         arc.fill()
         progressLayer?.path = arc.CGPath
         progressLayer?.fillColor = self.tintColor.CGColor
+        CGContextRestoreGState(ctx)
     }
-    
+    /*
     override public func layoutSubviews() {
         super.layoutSubviews()
-        if(borderLayer == nil) {
-            //backgroundColor = UIColor.clearColor()
-            let circle = UIBezierPath(ovalInRect: self.bounds)
-            circle.stroke()
-            borderLayer = CAShapeLayer()
-            borderLayer?.fillColor = UIColor.clearColor().CGColor
-            borderLayer?.strokeColor = tintColor.CGColor
-            borderLayer?.lineWidth = 2.0
-            borderLayer?.path = circle.CGPath
-            self.layer.addSublayer(borderLayer!)
-        }
     }
+    */
 
 }

        }
        didSet {
            dispatch_async(dispatch_get_main_queue(), {
                self.updateProgress()
                
                if(self.progress == 0 || self.progress >= 1) {
                    self.hidden = true
                }

    }

    private func updateProgress() {
        let ctx = UIGraphicsGetCurrentContext()
        CGContextSaveGState(ctx)
        if(borderLayer == nil) {
            borderLayer = CAShapeLayer()
            //backgroundColor = UIColor.clearColor()
            let circle = UIBezierPath(ovalInRect: self.bounds)
            circle.stroke()
            borderLayer?.fillColor = UIColor.clearColor().CGColor
            borderLayer?.strokeColor = tintColor.CGColor
            borderLayer?.lineWidth = 2.0
            borderLayer?.path = circle.CGPath
            self.layer.addSublayer(borderLayer!)
        }

        
        let center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds))
        var radius = self.bounds.size.width
        if(self.bounds.size.height < radius) {
