fixed estimator code to work entirely in ai