See my code comment further down about why `isInBatchMode` is a set instead of a boolean.  If a boolean is safe, this can be changed.