All these `if`s should be replaced with a `case`/`when`.