 		
 		if event != nil {
 		}
-
+		
 		let touchPoint = touches.first!.preciseLocationInView(self)
 		
 		self.touchDownPoint = touchPoint

	public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
		if self.currentAction == .Draw {
			if self.currentTool == .Pencil {
				// This is to generate a template
				
				var minX = CGFloat(HUGE)
				var minY = CGFloat(HUGE)
				
				for point in self.pointsBuffer {
					if point.x < minX {
						minX = point.x
					}
					if point.y < minY {
						minY = point.y
					}
				}
				
//				NSLog("BEGIN")
//				for point in self.pointsBuffer {
//					NSLog("%f, %f", point.x - minX, point.y - minY)
//				}
//				NSLog("END")
				let smartPath = ATSmartBezierPath(withPoints: self.pointsBuffer)
				var pathAppended = false
				
				if self.recognizeDrawing {
					let recognizedPathInfo = smartPath.recognizedPath()

					if recognizedPathInfo != nil {
						
						var recognizedPathIsAccepted = false

				
				if pathAppended == false {
					let smoothPath = smartPath.smoothPath(20)
					
					self.addShapeLayer(smoothPath, lineWidth: self.currentLineWidth, color: self.currentColor)
				}
				self.pointsBuffer.removeAll()
