Trying to fix math issues