added variable and changed first if equation.