     
     
     
-    override func drawRect(rect: CGRect) {
+    override public func drawRect(rect: CGRect) {
         self.committedImage.drawAtPoint(CGPointZero)
         self.currentTool.drawHistory(self.history)
     }
     
     
     
-    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
+    // MARK: Handling touches
+    override public func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
         guard let touch = touches.first else { return }
         
         let currentPoint = touch.locationInView(self)

        
        self.setNeedsDisplay()
    }
}



// MARK: - Geometry functions

func controlPoints(a: CGPoint, _ b: CGPoint, _ c: CGPoint, t: CGFloat) -> (CGPoint, CGPoint) {
    let d_ab = dist(a, b)
    let d_bc = dist(b, c)
    let fa = t * d_ab / (d_ab + d_bc)
    let fb = t * d_bc / (d_ab + d_bc)
    let r = CGPointMake(b.x - fa * (c.x - a.x), b.y - fa * (c.y - a.y))
    let s = CGPointMake(b.x + fb * (c.x - a.x), b.y + fb * (c.y - a.y))
    
    return (r, s);
}



func dist(a: CGPoint, _ b: CGPoint) -> CGFloat {
    let r2: CGFloat = pow(b.x - a.x, 2.0)
    let s2: CGFloat = pow(b.y - a.y, 2.0)
    return sqrt(r2 + s2)
}



func midPoint(a: CGPoint, _ b: CGPoint) -> CGPoint {
    return CGPointMake(0.5 * (a.x + b.x), 0.5 * (a.y + b.y))
}





            // Dot
            let first = tps[0]
            let second = tps[1]
            let mid = self.midPoint(first, second)
            let midDist = self.dist(first, mid)
    
            path.moveToPoint(first)
            let startAngle: CGFloat = 0.0
