Simplify OS check code