Use `unless` instead of `if`

It's generally better to use `unless` with a positive check (such as if it exists) then `if` with a negative check (such as if it is `nil`).