Solved a bug in calculating valueToFactor ratio