Correct_Formula_Order function

Corrects the order of terms/formula/etc