formulas changed to give the right result