diff --git a/src/schema_compile.c b/src/schema_compile.c
index 44821bc..a692b7b 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -969,14 +969,14 @@
         when = ((struct lysc_node_case *)node)->when;
         break;
     case LYS_NOTIF:
-        when = ((struct lysc_notif *)node)->when;
-        musts = ((struct lysc_notif *)node)->musts;
+        when = ((struct lysc_node_notif *)node)->when;
+        musts = ((struct lysc_node_notif *)node)->musts;
         break;
     case LYS_RPC:
     case LYS_ACTION:
         /* first process when and input musts */
-        when = ((struct lysc_action *)node)->when;
-        musts = ((struct lysc_action *)node)->input.musts;
+        when = ((struct lysc_node_action *)node)->when;
+        musts = ((struct lysc_node_action *)node)->input.musts;
         break;
     default:
         /* nothing to check */
@@ -1073,7 +1073,7 @@
         /* now check output musts */
         input_done = 1;
         when = NULL;
-        musts = ((struct lysc_action *)node)->output.musts;
+        musts = ((struct lysc_node_action *)node)->output.musts;
         opts = LYXP_SCNODE_OUTPUT;
         goto check_musts;
     }
@@ -1475,31 +1475,10 @@
 lys_compile_unres_mod(struct lysc_ctx *ctx)
 {
     struct lysc_node *node;
-    struct lysc_action **actions;
-    struct lysc_notif **notifs;
     struct lysc_augment *aug;
     struct lysc_deviation *dev;
-    struct ly_set disabled_op = {0};
     uint32_t i;
 
-#define ARRAY_DEL_ITEM(array, item) \
-    { \
-        LY_ARRAY_COUNT_TYPE u__; \
-        LY_ARRAY_FOR(array, u__) { \
-            if ((array) + u__ == item) { \
-                LY_ARRAY_DECREMENT(array); \
-                if (u__ < LY_ARRAY_COUNT(array)) { \
-                    memmove((array) + u__, (array) + u__ + 1, (LY_ARRAY_COUNT(array) - u__) * sizeof *(array)); \
-                } \
-                if (!LY_ARRAY_COUNT(array)) { \
-                    LY_ARRAY_FREE(array); \
-                    (array) = NULL; \
-                } \
-                break; \
-            } \
-        } \
-    }
-
     /* remove all disabled nodes */
     for (i = 0; i < ctx->disabled.count; ++i) {
         node = ctx->disabled.snodes[i];
@@ -1510,47 +1489,9 @@
             return LY_EVALID;
         }
 
-        if (node->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) {
-            /* just remember all RPCs/actions/notifs for now */
-            ly_set_add(&disabled_op, node, 1, NULL);
-        } else {
-            lysc_node_free(ctx->ctx, node, 1);
-        }
+        lysc_node_free(ctx->ctx, node, 1);
     }
 
-    /* remove ops also from their arrays, from end so as not to move other items and change these pointer targets */
-    i = disabled_op.count;
-    while (i) {
-        --i;
-        node = disabled_op.snodes[i];
-        if (node->nodetype == LYS_RPC) {
-            actions = &node->module->compiled->rpcs;
-            assert(actions);
-            notifs = NULL;
-        } else if (node->nodetype == LYS_ACTION) {
-            actions = lysc_node_actions_p(node->parent);
-            assert(actions);
-            notifs = NULL;
-        } else if (node->parent) {
-            actions = NULL;
-            notifs = lysc_node_notifs_p(node->parent);
-            assert(notifs);
-        } else {
-            actions = NULL;
-            notifs = &node->module->compiled->notifs;
-            assert(notifs);
-        }
-
-        if (actions) {
-            lysc_action_free(ctx->ctx, (struct lysc_action *)node);
-            ARRAY_DEL_ITEM(*actions, (struct lysc_action *)node);
-        } else {
-            lysc_notif_free(ctx->ctx, (struct lysc_notif *)node);
-            ARRAY_DEL_ITEM(*notifs, (struct lysc_notif *)node);
-        }
-    }
-    ly_set_erase(&disabled_op, NULL);
-
     /* check that all augments were applied */
     for (i = 0; i < ctx->augs.count; ++i) {
         aug = ctx->augs.objs[i];
@@ -1580,7 +1521,6 @@
     }
 
     return LY_SUCCESS;
-#undef ARRAY_DEL_ITEM
 }
 
 /**
@@ -1730,8 +1670,8 @@
     struct lysp_module *sp;
     struct lysp_submodule *submod;
     struct lysp_node *pnode;
-    struct lysp_grp *grps;
-    LY_ARRAY_COUNT_TYPE u, v;
+    struct lysp_node_grp *grp;
+    LY_ARRAY_COUNT_TYPE u;
     LY_ERR ret = LY_SUCCESS;
 
     LY_CHECK_ARG_RET(NULL, mod, mod->parsed, !mod->compiled, mod->ctx, LY_EINVAL);
@@ -1778,9 +1718,15 @@
         LY_CHECK_GOTO(ret = lys_compile_node(&ctx, pnode, NULL, 0, NULL), error);
     }
 
-    /* top-level RPCs and notifications */
-    COMPILE_OP_ARRAY_GOTO(&ctx, sp->rpcs, mod_c->rpcs, NULL, lys_compile_action, 0, ret, error);
-    COMPILE_OP_ARRAY_GOTO(&ctx, sp->notifs, mod_c->notifs, NULL, lys_compile_notif, 0, ret, error);
+    /* top-level RPCs */
+    LY_LIST_FOR((struct lysp_node *)sp->rpcs, pnode) {
+        LY_CHECK_GOTO(ret = lys_compile_node(&ctx, pnode, NULL, 0, NULL), error);
+    }
+
+    /* top-level notifications */
+    LY_LIST_FOR((struct lysp_node *)sp->notifs, pnode) {
+        LY_CHECK_GOTO(ret = lys_compile_node(&ctx, pnode, NULL, 0, NULL), error);
+    }
 
     /* extension instances */
     COMPILE_EXTS_GOTO(&ctx, sp->exts, mod_c->exts, mod_c, LYEXT_PAR_MODULE, ret, error);
@@ -1795,8 +1741,15 @@
             LY_CHECK_GOTO(ret, error);
         }
 
-        COMPILE_OP_ARRAY_GOTO(&ctx, submod->rpcs, mod_c->rpcs, NULL, lys_compile_action, 0, ret, error);
-        COMPILE_OP_ARRAY_GOTO(&ctx, submod->notifs, mod_c->notifs, NULL, lys_compile_notif, 0, ret, error);
+        LY_LIST_FOR((struct lysp_node *)submod->rpcs, pnode) {
+            ret = lys_compile_node(&ctx, pnode, NULL, 0, NULL);
+            LY_CHECK_GOTO(ret, error);
+        }
+
+        LY_LIST_FOR((struct lysp_node *)submod->notifs, pnode) {
+            ret = lys_compile_node(&ctx, pnode, NULL, 0, NULL);
+            LY_CHECK_GOTO(ret, error);
+        }
 
         COMPILE_EXTS_GOTO(&ctx, submod->exts, mod_c->exts, mod_c, LYEXT_PAR_MODULE, ret, error);
     }
@@ -1805,16 +1758,15 @@
     /* validate non-instantiated groupings from the parsed schema,
      * without it we would accept even the schemas with invalid grouping specification */
     ctx.options |= LYS_COMPILE_GROUPING;
-    LY_ARRAY_FOR(sp->groupings, u) {
-        if (!(sp->groupings[u].flags & LYS_USED_GRP)) {
-            LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, NULL, &sp->groupings[u]), error);
+    LY_LIST_FOR(sp->groupings, grp) {
+        if (!(grp->flags & LYS_USED_GRP)) {
+            LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, NULL, grp), error);
         }
     }
     LY_LIST_FOR(sp->data, pnode) {
-        grps = (struct lysp_grp *)lysp_node_groupings(pnode);
-        LY_ARRAY_FOR(grps, u) {
-            if (!(grps[u].flags & LYS_USED_GRP)) {
-                LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, pnode, &grps[u]), error);
+        LY_LIST_FOR((struct lysp_node_grp *)lysp_node_groupings(pnode), grp) {
+            if (!(grp->flags & LYS_USED_GRP)) {
+                LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, pnode, grp), error);
             }
         }
     }
@@ -1822,16 +1774,15 @@
         submod = sp->includes[u].submodule;
         ctx.pmod = (struct lysp_module *)submod;
 
-        LY_ARRAY_FOR(submod->groupings, v) {
-            if (!(submod->groupings[v].flags & LYS_USED_GRP)) {
-                LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, NULL, &submod->groupings[v]), error);
+        LY_LIST_FOR(submod->groupings, grp) {
+            if (!(grp->flags & LYS_USED_GRP)) {
+                LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, NULL, grp), error);
             }
         }
         LY_LIST_FOR(submod->data, pnode) {
-            grps = (struct lysp_grp *)lysp_node_groupings(pnode);
-            LY_ARRAY_FOR(grps, v) {
-                if (!(grps[v].flags & LYS_USED_GRP)) {
-                    LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, pnode, &grps[v]), error);
+            LY_LIST_FOR((struct lysp_node_grp *)lysp_node_groupings(pnode), grp) {
+                if (!(grp->flags & LYS_USED_GRP)) {
+                    LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, pnode, grp), error);
                 }
             }
         }
