diff --git a/js/authencated_users_toggle.js b/js/authencated_users_toggle.js
index 1c18c4f..5690842 100644
--- a/js/authencated_users_toggle.js
+++ b/js/authencated_users_toggle.js
@@ -4,13 +4,14 @@
 (function ($, Drupal) {
   Drupal.behaviors.jsonapi_role_access = {
     attach: function attach(context) {
-      $('#edit-roles-authenticated').click(function () {
-        $('.js-form-item.js-form-type-checkbox input').each(function () {
-          if ($.inArray($(this).val(), ['anonymous', 'authenticated']) === -1) {
-            $(this).parent().toggle();
-          }
-        })
-      });
+      $('#edit-roles-authenticated').on('click', this.toggle).each(this.toggle);
     },
+    toggle: function toggle() {
+      var isAuthChecked = $('#edit-roles-authenticated').is(':checked');
+      // Removing first 2 options, as they will always be Anon and Auth roles.
+      $('.js-form-item.js-form-type-checkbox').slice(2).each(function () {
+        this.style.display = isAuthChecked ? 'none' : '';
+      });
+    }
   };
 })(jQuery, Drupal);
