Code : Remove repeated calculations from scale factor estimator