Avoid unnecessary nesting of the code.

The `else` statement can be avoided by returning directly from the `if`
block. This avoids unnecessary nesting of the code and makes it easy to
read.