Update Ghazal.algorithm for formulas