Couldn't this be collapsed into an `elseif`?