replaced division '/' with computeRatio to avoid infinities