         
         let animation = CAKeyframeAnimation(keyPath: "position")
         animation.path = path
-        animation.duration = 1
+        layer.removeAllAnimations()
         layer.add(animation, forKey: "animate position along path")
     }
     
-    
-    func handleDragHue(_ gestureRecognizer: UILongPressGestureRecognizer) {
-        if (gestureRecognizer.state == .began) || (gestureRecognizer.state == .changed) {
+    func handlePanHue(_ gestureRecognizer: UIPanGestureRecognizer) {
+        if gestureRecognizer.state == .began {
+            panStarted = isTapOnCircle(gestureRecognizer) // Not on circle but on the marker
+        }
+        if (gestureRecognizer.state == .began || gestureRecognizer.state == .changed) &&
+            panStarted {
+            let position: CGPoint = gestureRecognizer.location(in: self)
+            let radians: CGFloat = atan2(center.y - position.y, position.x - center.x)
+            colorHue = radians / (2.0 * .pi)
+            if colorHue < 0.0 {
+                colorHue += 1.0
+            }
+            let color = UIColor(hue: colorHue, saturation: CGFloat(1), brightness: CGFloat(1), alpha: CGFloat(1))
+            
+            CATransaction.begin()
+            CATransaction.setDisableActions(true)
+            
+            hueMarkerLayer.position = self.getHueMarkerPosition()
+            hueMarkerLayer.backgroundColor = color.cgColor
+            colorCenterLayer.backgroundColor = color.cgColor
+            
+            CATransaction.commit()
+        }
+    }
+
+    
+    func handleTapHue(_ gestureRecognizer: UITapGestureRecognizer) {
+        if !isTapOnCircle(gestureRecognizer) {
+            return
+        }
+        
             let position: CGPoint = gestureRecognizer.location(in: self)
             let distanceSquared: CGFloat = (center.x - position.x) * (center.x - position.x) + (center.y - position.y) * (center.y - position.y)
             if distanceSquared < 1.0e-3 {

        colorCenterLayer.setNeedsDisplay()
        self.layer.addSublayer(colorCenterLayer)
        
        hueGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(handleDragHue))
        hueGestureRecognizer.minimumPressDuration = 0;
        hueGestureRecognizer.delegate = self
        self.addGestureRecognizer(hueGestureRecognizer)
        
        backgroundColor = UIColor.init(red: 39/256, green: 46/256, blue: 65/256, alpha: 1.0)
    }
    
    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
        if ( gestureRecognizer == hueGestureRecognizer )
        {
            let position: CGPoint = gestureRecognizer.location(in: self)
            let distanceSquared: CGFloat = (center.x - position.x) * (center.x - position.x) + (center.y - position.y) * (center.y - position.y)
            return ((radius - thickness) * (radius - thickness) < distanceSquared) && (distanceSquared <= radius * radius)
        }
        return true
    }
    
    func move(_ layer: CALayer, from oldHue: CGFloat, to newHue: CGFloat) {
        let path: CGMutablePath = CGMutablePath()
        let center = CGPoint(x: CGFloat(self.bounds.size.width / 2.0), y: CGFloat(self.bounds.size.height / 2.0))

        if (newHue > oldHue) {
            if (newHue - oldHue < 0.5) {
                path.addArc(center: center, radius: CGFloat(radius), startAngle: -oldHue * 2.0 * .pi, endAngle: -newHue * 2.0 * .pi, clockwise: true, transform: .identity)

            let color = UIColor(hue: colorHue, saturation: CGFloat(1), brightness: CGFloat(1), alpha: CGFloat(1))
            hueMarkerLayer.backgroundColor = color.cgColor
            colorCenterLayer.backgroundColor = color.cgColor
    }

    func getHueMarkerPosition() -> CGPoint {
