Added if statement and second equation.