Simplify if-test