Made many improvements and fixes to formulas.