Add THcFormula class