simplify if statement a bit