refactored estimator math functions to pass by reference