         self.addSubview(self.activeBarView)
     }
     
-//    override func beginTrackingWithTouch(touch: UITouch, withEvent event: UIEvent) -> Bool {
-//        
-//    }
-//    
-//    override func continueTrackingWithTouch(touch: UITouch, withEvent event: UIEvent) -> Bool {
-//        
-//    }
-//    
-//    override func endTrackingWithTouch(touch: UITouch, withEvent event: UIEvent) {
-//        
-//    }
-    
-    /////////////////////////////////////////////////////
-    //
-    /////////////////////////////////////////////////////
-    func handleLeftPan(gestureRecognizer: UIPanGestureRecognizer)
-    {
-        if (gestureRecognizer.state == UIGestureRecognizerState.Began || gestureRecognizer.state == UIGestureRecognizerState.Changed)
-        {
-            let translation = gestureRecognizer.translationInView(self)
-            let range = self.maximumValue - self.minimumValue
-            let availableWidth = self.inactiveBarView.frame.width
-            
-            let newValue = self.leftValue + Float(translation.x) / Float(availableWidth) * range
-           
-            self.leftValue = newValue
-            
-            if (self.leftValue < minimumValue)
-            {
-                self.leftValue = minimumValue
-            }
-            
-            if (self.leftValue > self.rightValue)
-            {
-                self.leftValue = self.rightValue
-            }
-            self.sendActionsForControlEvents(UIControlEvents.ValueChanged)
-            
-            gestureRecognizer.setTranslation(CGPointZero, inView: self)
-            self.setNeedsLayout()
-        }
-    }
-    
-     /////////////////////////////////////////////////////
-    //
-    /////////////////////////////////////////////////////
-    func handleRightPan(gestureRecognizer: UIPanGestureRecognizer)
-    {
-        if (gestureRecognizer.state == UIGestureRecognizerState.Began || gestureRecognizer.state == UIGestureRecognizerState.Changed)
-        {
-            let translation = gestureRecognizer.translationInView(self)
-            let range = self.maximumValue - self.minimumValue
-            let availableWidth = self.inactiveBarView.frame.width
-            let newValue = self.rightValue + Float(translation.x) / Float(availableWidth) * range
-
-            self.rightValue = newValue
-
-            if (self.rightValue > self.maximumValue)
+    /////////////////////////////////////////////////////
+    //
+    /////////////////////////////////////////////////////
+    override func beginTrackingWithTouch(touch: UITouch, withEvent event: UIEvent) -> Bool
+    {
+        previousLocation = touch.locationInView(self)
+        
+        // Hit test the thumb layers
+        if leftThumbView.frame.contains(previousLocation)
+        {
+            trackedElement = .LeftThumb
+        }
+        else if rightThumbView.frame.contains(previousLocation)
+        {
+            trackedElement = .RightThumb
+        }
+        else if middleThumbView.frame.contains(previousLocation)
+        {
+            trackedElement = .MiddleThumb
+        }
+        
+        return trackedElement != .None
+    }
+
+    /////////////////////////////////////////////////////
+    //
+    /////////////////////////////////////////////////////
+    override func continueTrackingWithTouch(touch: UITouch, withEvent event: UIEvent) -> Bool
+    {
+        let location = touch.locationInView(self)
+        
+        // 1. Determine by how much the user has dragged
+        let deltaLocation = Double(location.x - previousLocation.x)
+        let deltaValue = (Double(maximumValue) - Double(minimumValue)) * deltaLocation / Double(bounds.width /*- thumbWidth*/)
+        
+        switch trackedElement
+        {
+        case .LeftThumb:
+            handleLeftThumbMove(location, delta: deltaValue)
+        case .MiddleThumb:
+            handleMiddleThumbMove(location, delta: deltaValue)
+        case .RightThumb:
+            handleRightThumbMove(location, delta: deltaValue)
+        default:
+            break
+        }
+        
+        previousLocation = location
+        
+        return true
+    }
+
+    /////////////////////////////////////////////////////
+    //
+    /////////////////////////////////////////////////////
+    func handleLeftThumbMove(location:CGPoint, delta:Double)
+    {
+        let translation = CGPointMake(location.x - previousLocation.x,location.y - previousLocation.y)
+        let range = self.maximumValue - self.minimumValue
+        let availableWidth = self.inactiveBarView.frame.width
+        
+        let newValue = self.leftValue + Float(translation.x) / Float(availableWidth) * range
+        
+        self.leftValue = newValue
+        
+        if (self.leftValue < minimumValue)
+        {
+            self.leftValue = minimumValue
+        }
+        
+        if (self.leftValue > self.rightValue)
+        {
+            self.leftValue = self.rightValue
+        }
+        self.sendActionsForControlEvents(UIControlEvents.ValueChanged)
+        
+        self.setNeedsLayout()
+    }
+    
+    /////////////////////////////////////////////////////
+    //
+    /////////////////////////////////////////////////////
+    func handleMiddleThumbMove(location:CGPoint, delta:Double)
+    {
+        let translation = CGPointMake(location.x - previousLocation.x,location.y - previousLocation.y)
+        let range = self.maximumValue - self.minimumValue
+        let availableWidth = self.inactiveBarView.frame.width
+        let diff = self.rightValue - self.leftValue
+        
+        let newLeftValue = self.leftValue + Float(translation.x) / Float(availableWidth) * range
+        if (newLeftValue < minimumValue)
+        {
+            self.leftValue = self.minimumValue
+            self.rightValue = self.leftValue + diff
+        }
+        else
+        {
+            let newRightValue = self.rightValue + Float(translation.x) / Float(availableWidth) * range
+            if (newRightValue > self.maximumValue)
             {
                 self.rightValue = self.maximumValue
-            }
-            
-            if (self.rightValue < self.leftValue)
-            {
-                self.rightValue = self.leftValue
-            }
-            self.sendActionsForControlEvents(UIControlEvents.ValueChanged)
-
-            gestureRecognizer.setTranslation(CGPointZero, inView: self)
-            self.setNeedsLayout()
-        }
-    }
-    
-    /////////////////////////////////////////////////////
-    //
-    /////////////////////////////////////////////////////
-    func handleMiddlePan(gestureRecognizer: UIPanGestureRecognizer)
-    {
-        if (gestureRecognizer.state == UIGestureRecognizerState.Began || gestureRecognizer.state == UIGestureRecognizerState.Changed)
-        {
-            let translation = gestureRecognizer.translationInView(self)
-            let range = self.maximumValue - self.minimumValue
-            let availableWidth = self.inactiveBarView.frame.width
-            let diff = self.rightValue - self.leftValue
-            
-            let newLeftValue = self.leftValue + Float(translation.x) / Float(availableWidth) * range
-            if (newLeftValue < minimumValue)
-            {
-                self.leftValue = self.minimumValue
+                self.leftValue = self.rightValue - diff
+            }
+            else
+            {
+                self.leftValue = newLeftValue
                 self.rightValue = self.leftValue + diff
             }
-            else
-            {
-                let newRightValue = self.rightValue + Float(translation.x) / Float(availableWidth) * range
-                if (newRightValue > self.maximumValue)
-                {
-                    self.rightValue = self.maximumValue
-                    self.leftValue = self.rightValue - diff
-                }
-                else
-                {
-                    self.leftValue = newLeftValue
-                    self.rightValue = self.leftValue + diff
-                }
-            }
-            
-            self.sendActionsForControlEvents(UIControlEvents.ValueChanged)
-            gestureRecognizer.setTranslation(CGPointZero, inView: self)
-            self.setNeedsLayout()
-        }
-    }
-    
-    /////////////////////////////////////////////////////
-    //
-    /////////////////////////////////////////////////////
-    
-    /////////////////////////////////////////////////////
-    //
-    /////////////////////////////////////////////////////
+        }
+        
+        self.sendActionsForControlEvents(UIControlEvents.ValueChanged)
+        self.setNeedsLayout()
+    }
+    
+    /////////////////////////////////////////////////////
+    //
+    /////////////////////////////////////////////////////
+    func handleRightThumbMove(location:CGPoint, delta:Double)
+    {
+        let translation = CGPointMake(location.x - previousLocation.x,location.y - previousLocation.y)
+        let range = self.maximumValue - self.minimumValue
+        let availableWidth = self.inactiveBarView.frame.width
+        let newValue = self.rightValue + Float(translation.x) / Float(availableWidth) * range
+        
+        self.rightValue = newValue
+        
+        if (self.rightValue > self.maximumValue)
+        {
+            self.rightValue = self.maximumValue
+        }
+        
+        if (self.rightValue < self.leftValue)
+        {
+            self.rightValue = self.leftValue
+        }
+        self.sendActionsForControlEvents(UIControlEvents.ValueChanged)
+        
+        self.setNeedsLayout()
+    }
+    
+    /////////////////////////////////////////////////////
+    //
+    /////////////////////////////////////////////////////
+    override func endTrackingWithTouch(touch: UITouch, withEvent event: UIEvent)
+    {
+        trackedElement = .None
+    }
+
 }

        self.middleThumbView.layer.shadowOffset = CGSizeMake(0.0, 4.0)
        self.middleThumbView.layer.shadowColor = UIColor.grayColor().CGColor
        self.middleThumbView.layer.shadowRadius = 2.0
        self.middleThumbView.addGestureRecognizer(self.middlePanGestureRecognizer!)
        
        self.leftThumbView = UIView(frame: CGRectMake(0, 0, 27, 27))
        self.leftThumbView.addGestureRecognizer(self.leftPanGestureRecognizer!)
        var path = UIBezierPath(arcCenter: CGPointMake(27.0, 13.5), radius: CGFloat(13.5), startAngle: CGFloat(M_PI/2.0), endAngle: CGFloat(M_PI*1.5), clockwise: true)
        path.closePath()
        var layer = CAShapeLayer()

        layer.shadowOffset = CGSizeMake(3.0, 4.0)
        layer.shadowColor = UIColor.grayColor().CGColor
        self.rightThumbView.layer.addSublayer(layer)
        self.rightThumbView.userInteractionEnabled = false
        
        self.orderSubviews()
        
