Combine these if statements into one to reduce the cyclomatic complexity.