         }
         let scale = min(xScale, yScale)
         
-        pointIndex = 0
+        var pointIndex = 0
         return inputDigit.map { subPath in
             return subPath.filter({ point in
                 let drop = pointIndex % dropIndexes == 0
                 pointIndex++
                 return !drop
             }).map({ point in
-                let x = (point.x - xMean) * scale
-                let y = (point.y - yMean) * scale
+                let x = (point.x - xTranslate) * scale
+                let y = (point.y - yTranslate) * scale
                 return CGPointMake(x, y)
             })
         }

        while sampleIndex + 1 < sample.count - minNeighborSize && prototypeIndex + 1 < prototype.count - minNeighborSize {
            
            // We want to use the same window size to compare all options, so it must be safe for all cases
            let maxNeighborSize = 5
            let safeNeighborSize = min(sampleIndex, sample.count - 1 - (sampleIndex + 1),
                prototypeIndex, prototype.count - 1 - (prototypeIndex + 1),
                maxNeighborSize)

    }
    
    func greedyDynamicTimeWarp(sample: [CGPoint], prototype: [CGPoint]) -> CGFloat {
        let minNeighborSize = 3
        let maxNeighborSize = 5
        if sample.count < minNeighborSize * 4 || prototype.count < minNeighborSize * 4 {
            return CGFloat.max
        }
