maybe this for could be extracted to a method for clarity. Such as notifySwitchListeners