             
             let difference = aVector - bVector
             let differenceDistance = difference.length()
-            let windowScale = 1.0 / (CGFloat(neighbors * neighbors))
+            let windowScale: CGFloat = 1.0
             totalDistance += differenceDistance * windowScale
         }
         
-        return totalDistance
+        return totalDistance / CGFloat(neighborsRange)
     }
     
     func greedyDynamicTimeWarp(sample: [CGPoint], prototype: [CGPoint]) -> CGFloat {
-        let minNeighborSize = 3
-        let maxNeighborSize = 5
+        let minNeighborSize = 2
+        let maxNeighborSize = 8
         if sample.count < minNeighborSize * 4 || prototype.count < minNeighborSize * 4 {
             return CGFloat.max
         }

        var pointIndex = 0
        var droppedDistance: Double = 0
        return inputDigit.map { subPath in
            return subPath.filter({ point in
                var drop = false
                if droppedDistance + dropEveryDistance < Double(pointIndex) {
                    drop = true
                    droppedDistance += dropEveryDistance
                }
                pointIndex++
                return !drop
            }).map({ point in
                let x = (point.x - xTranslate) * scale
                let y = (point.y - yTranslate) * scale
                return CGPointMake(x, y)

                    let totalPoints = normalizedDigit.reduce(0) {(total, stroke) -> Int in
                        return total + stroke.count
                    }
                    //println("Normalized digit \(label) to \(totalPoints) points")
                    addToLibrary(&self.normalizedPrototypeLibrary, label: label, digit: normalizedDigit)
                }
            }
