modify to slightly refactor the selectors of IF statement