Added variable to code and condition to the else if