Tried to fix some of the math