reworked formulas

Reworked all formulas and now working. Only need to fix seekbar at this
point.