     
     public subscript(index : Int) -> SDPathCommand {
         get {
-            return segment[index]
+            return commands[index]
         }
         set {
-            segment[index] = newValue
+            commands[index] = newValue
         }
     }
     
     public var count : Int {
-        return segment.count
+        return commands.count
     }
     
     public var startIndex: Int {
-        return segment.startIndex
+        return commands.startIndex
     }
     
     public var endIndex: Int {
-        return segment.endIndex
+        return commands.endIndex
     }
     
     

extension SDPath : RangeReplaceableCollectionType {
    
    public mutating func append(x: SDPathCommand) {
        segment.append(x)
    }
    
    public mutating func appendContentsOf<S : SequenceType where S.Generator.Element == SDPathCommand>(newElements: S) {
        segment.appendContentsOf(newElements)
    }
    
    public mutating func removeLast() -> SDPathCommand {
        return segment.removeLast()
    }
    
    public mutating func popLast() -> SDPathCommand? {
        return segment.popLast()
    }
    
    public mutating func reserveCapacity(minimumCapacity: Int) {
        segment.reserveCapacity(minimumCapacity)
    }
    
    public mutating func removeAll(keepCapacity keepCapacity: Bool = false) {
        segment.removeAll(keepCapacity: keepCapacity)
    }
    
    public mutating func replaceRange<C : CollectionType where C.Generator.Element == SDPathCommand>(subRange: Range<Int>, with newElements: C) {
        segment.replaceRange(subRange, with: newElements)
    }
    
    public mutating func insert(newElement: SDPathCommand, atIndex i: Int) {
        segment.insert(newElement, atIndex: i)
    }
    
    public mutating func insertContentsOf<S : CollectionType where S.Generator.Element == SDPathCommand>(newElements: S, at i: Int) {
        segment.insertContentsOf(newElements, at: i)
    }
    
    public mutating func removeAtIndex(i: Int) -> SDPathCommand {
        return segment.removeAtIndex(i)
    }
    
    public mutating func removeRange(subRange: Range<Int>) {
        segment.removeRange(subRange)
    }
}


    
    public var boundary : Rect {
        var bound: Rect? = nil
        self.apply { commands, state in
            switch commands {
            case let line as SDPath.Line:
                if bound == nil {
                    bound = line.bound(state.last)
