InternFormula refactor + bug fix + tests
internFormula refactor + tests