 
 public extension CGPath {
     func enumerate(block:(type:CGPathElementType, points:[CGPoint]) -> Void) {
-        var curpt  = CGPoint()
+        var curpt = CGPoint()
+        var start = curpt
         
         CGPathApplyWithBlock(self) {
             (elementPtr:UnsafePointer<CGPathElement>) -> Void in

        var pt:CGPoint?
        var i = 0
        
        CGPathApplyWithBlock(self) {
            (elementPtr:UnsafePointer<CGPathElement>) -> Void in
            if index == i++ {
                let element : CGPathElement = elementPtr.memory
                pt = element.points.memory
            }
        }
        return pt

                curpt = points[3]
            
            case kCGPathElementCloseSubpath.value:
                block(type:kCGPathElementCloseSubpath, points:[curpt, start])
            default:
                println("default")
            }
