Flatten if-stmt