Return early where possible.

Avoid multiple nesting of conditionals that cover the rest of the method by checking for the conditional inverse and returning early where possible. This makes the code easier to follow and understand.

Follows-up on 80c5fba323f5a72ef84f529949f4701b67c47beb