Reduce the if chain.