There are only three cases, and while the code is longer it is also hopefully easier to read. Moreover, an error message is casted if we're doing something unexpected.