clean up code for formula_parser and add few test cases