fixed some of the math