simplify if conditions