Collapsed if statements to make code conform to Apache coding standard