Condensed the logic into a one-time check