Dropped part of the large if down a line to help readability