             if elapsedTime < CGFloat(duration) {
 
                 if dampingRatio < 1 {
-
-                    A = A ?? initialDistance
-                    B = B ?? (dampingRatio * naturalFrequency - velocity) * initialDistance / dampedFrequency
-
-                    currentValue = finalValue - exp(-dampingRatio * naturalFrequency * elapsedTime) * (A * cos(dampedFrequency * elapsedTime) + B * sin(dampedFrequency * elapsedTime))
+                    
+                    let dampingExp:CGFloat = exp(-dampingRatio * naturalFrequency * elapsedTime)
+                    let ADamp:CGFloat = A * cos(dampedFrequency * elapsedTime)
+                    let BDamp:CGFloat = B * sin(dampedFrequency * elapsedTime)
+
+                    currentValue = finalValue - dampingExp * (ADamp + BDamp)
                 }
                 else if dampingRatio == 1 {
-
-                    A = A ?? initialDistance
-                    B = B ?? (naturalFrequency - velocity) * initialDistance
-
-                    currentValue = finalValue - exp(-dampingRatio * naturalFrequency * elapsedTime) * (A + B * elapsedTime)
+                    
+                    let dampingExp: CGFloat = exp(-dampingRatio * naturalFrequency * elapsedTime)
+
+                    currentValue = finalValue - dampingExp * (A + B * elapsedTime)
                 }
                 else {
 
-                    A = A ?? (t1 * t2 / (t1 - t2)) * initialDistance * (1/t2 - velocity)
-                    B = B ?? (t1 * t2 / (t2 - t1)) * initialDistance * (1/t1 - velocity)
-
-                    currentValue = finalValue - A * exp(-elapsedTime/t1) - B * exp(-elapsedTime/t2)
+                    let ADamp:CGFloat =  A * exp(-elapsedTime/t1)
+                    let BDamp:CGFloat = B * exp(-elapsedTime/t2)
+                    currentValue = finalValue - ADamp - BDamp
                 }
             }
             else {

                dampedFrequency = naturalFrequency * sqrt(1 - pow(dampingRatio, 2))
                t1 = 1 / (naturalFrequency * (dampingRatio - sqrt(pow(dampingRatio, 2) - 1)))
                t2 = 1 / (naturalFrequency * (dampingRatio + sqrt(pow(dampingRatio, 2) - 1)))
            }

            var currentValue: CGFloat!

            if initialValue == nil {

                initialValue = node.valueForKeyPath(keyPath) as! CGFloat
                initialDistance = initialDistance ?? finalValue - initialValue!
                finalValue = finalValue ?? initialValue! + initialDistance

                var magicNumber: CGFloat! // picked manually to visually match the behavior of UIKit
                if dampingRatio < 1 { magicNumber = 8 / dampingRatio }
