Flatten if statement