Give some variables more meaningful names.

And remove a reversed double conditional.