re-order to put if statements before operators