     let image = UIImage(named: "dog.jpg")!
     var layers = [CALayer]()
     var index = 0
-    var xform = CGAffineTransformIdentity
+    var xform = CGAffineTransformIdentity {
+        didSet {
+            shapeLayer.lineWidth = 30 / xform.a
+            builder.minSegment = 8.0 / xform.a
+        }
+    }
 
     var builder = SNPathBuilder(minSegment: 8.0)
     lazy var shapeLayer:CAShapeLayer = {

    private func createShapeLayer() -> CAShapeLayer {
        let layer = CAShapeLayer()
        layer.contentsScale = UIScreen.mainScreen().scale
        layer.lineWidth = 10
        layer.fillColor = UIColor.clearColor().CGColor
        layer.strokeColor = UIColor(red: 1, green: 0, blue: 1, alpha: 1).CGColor
        layer.shadowRadius = 2.0

    }
    
    @IBAction func undo() {
        index -= 1
        maskView.image = image
        renderLayers(0..<index)
