     private var redoEnabled = false
     private var clearEnabled = false
     
+    /// init: initializes a TouchDrawView instance
+    /// - Parameter: frame: frame for the view to be initialized in
     override init(frame: CGRect) {
         super.init(frame: frame)
         initTouchDrawView()
     }
-
+    
+    /// init: initializes a TouchDrawView instance
+    /// - Parameter: coder aDecoder: NSCoder to initialize the view
     required public init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
         initTouchDrawView()


public class TouchDrawView: UIView {

    public var delegate: TouchDrawViewDelegate!
    
    // Used for undo/redo
    private var stack: [Stroke]!
    private var pointsArray: NSMutableArray!
    
    private var lastPoint = CGPoint.zero
    
    private var brushProperties = BrushProperties()
    
    private var touchesMoved = false

        }
    }
    
    // MARK: - Actions
    
    override public func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        touchesMoved = false
        if let touch = touches.first {
            lastPoint = touch.locationInView(self)
            pointsArray = []
            pointsArray.addObject(NSStringFromCGPoint(lastPoint))
        }
    }
    
    override public func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
        touchesMoved = true
        if let touch = touches.first {
            let currentPoint = touch.locationInView(self)
            drawLineFrom(lastPoint, toPoint: currentPoint, properties: brushProperties)
            
            lastPoint = currentPoint
            pointsArray.addObject(NSStringFromCGPoint(lastPoint))
        }
    }
    
    override public func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
        if !touchesMoved {
            // draw a single point
            drawLineFrom(lastPoint, toPoint: lastPoint, properties: brushProperties)
        }
        
        mergeViews()
        
        let stroke = Stroke()
        stroke.properties = BrushProperties(properties: brushProperties)
        stroke.points = pointsArray
        
        stack.append(stroke)
        
        undoManager?.registerUndoWithTarget(self, selector: "popDrawing", object: nil)
        
        if !undoEnabled {
            delegate.undoEnabled()
            undoEnabled = true
        }
        if redoEnabled {
            delegate.redoDisabled()
            redoEnabled = false
        }
        if !clearEnabled {
            self.delegate.clearEnabled()
            clearEnabled = true
        }
    }
}
