corrected math error and removed unnecessary variable