Shorter code

avoid continue, double lines and double calculation.

No functional change.
Revert and restart

Just convert more if to && statement