Clean up a series of ifs, remove redundant processing.

Also add brackets, we do not want to make the same kind of mistake
Apple did with their SSL goto bug.