Slight refactor of the check-for-shutdown logic