Implemented eval_formula