refactored(ml_formula): improved performance and semantics