Fix bad math.

My code was almost perfect.