Note the new syntax for `getApplicationMode()` does not require `settings` parameter so you can move this block outside the callback.