TestMethod for random formula creation and some fixes