Refactored FormulaTree