corrected model estimate code