diff --git a/src/parser_lyb.c b/src/parser_lyb.c
index d8c0ed6..81b640a 100644
--- a/src/parser_lyb.c
+++ b/src/parser_lyb.c
@@ -43,15 +43,16 @@
         struct lyd_node **first_p, struct ly_in *in, uint32_t parse_opts, uint32_t val_opts, uint32_t int_opts,
         struct ly_set *parsed, struct lyd_ctx **lydctx_p);
 
-static LY_ERR lyb_parse_subtree_r(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, struct lyd_node **first_p, struct ly_set *parsed);
+static LY_ERR lyb_parse_node(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, const struct lysc_node *snode, struct lyd_node **first_p, struct ly_set *parsed);
 static LY_ERR lyb_parse_node_header(struct lyd_lyb_ctx *lybctx, uint32_t *flags, struct lyd_meta **meta);
+static LY_ERR lyb_parse_siblings(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, struct lyd_node **first_p, struct ly_set *parsed);
 
 void
 lylyb_ctx_free(struct lylyb_ctx *ctx)
 {
     LY_ARRAY_COUNT_TYPE u;
 
-    LY_ARRAY_FREE(ctx->subtrees);
+    LY_ARRAY_FREE(ctx->siblings);
     LY_ARRAY_FREE(ctx->models);
 
     LY_ARRAY_FOR(ctx->sib_hts, u) {
@@ -83,7 +84,7 @@
 lyb_read(uint8_t *buf, size_t count, struct lylyb_ctx *lybctx)
 {
     LY_ARRAY_COUNT_TYPE u;
-    struct lyd_lyb_subtree *empty;
+    struct lyd_lyb_sibling *empty;
     size_t to_read;
     uint8_t meta_buf[LYB_META_BYTES];
 
@@ -93,13 +94,13 @@
         /* check for fully-read (empty) data chunks */
         to_read = count;
         empty = NULL;
-        LY_ARRAY_FOR(lybctx->subtrees, u) {
+        LY_ARRAY_FOR(lybctx->siblings, u) {
             /* we want the innermost chunks resolved first, so replace previous empty chunks,
              * also ignore chunks that are completely finished, there is nothing for us to do */
-            if ((lybctx->subtrees[u].written <= to_read) && lybctx->subtrees[u].position) {
+            if ((lybctx->siblings[u].written <= to_read) && lybctx->siblings[u].position) {
                 /* empty chunk, do not read more */
-                to_read = lybctx->subtrees[u].written;
-                empty = &lybctx->subtrees[u];
+                to_read = lybctx->siblings[u].written;
+                empty = &lybctx->siblings[u];
             }
         }
 
@@ -115,10 +116,10 @@
                 ly_in_skip(lybctx->in, to_read);
             }
 
-            LY_ARRAY_FOR(lybctx->subtrees, u) {
+            LY_ARRAY_FOR(lybctx->siblings, u) {
                 /* decrease all written counters */
-                lybctx->subtrees[u].written -= to_read;
-                assert(lybctx->subtrees[u].written <= LYB_SIZE_MAX);
+                lybctx->siblings[u].written -= to_read;
+                assert(lybctx->siblings[u].written <= LYB_SIZE_MAX);
             }
             /* decrease count/buf */
             count -= to_read;
@@ -179,7 +180,7 @@
  * @brief Read a string.
  *
  * @param[in] str Destination buffer, is allocated.
- * @param[in] with_length Whether the string is preceded with its length or it ends at the end of this subtree.
+ * @param[in] with_length Whether the string is preceded with its length or it ends at the end of this "sibling".
  * @param[in] lybctx LYB context.
  * @return LY_ERR value.
  */
@@ -194,9 +195,9 @@
     if (with_length) {
         lyb_read_number(&len, sizeof len, 2, lybctx);
     } else {
-        /* read until the end of this subtree */
-        len = LYB_LAST_SUBTREE(lybctx).written;
-        if (LYB_LAST_SUBTREE(lybctx).position) {
+        /* read until the end of this "sibling" */
+        len = LYB_LAST_SIBLING(lybctx).written;
+        if (LYB_LAST_SIBLING(lybctx).position) {
             next_chunk = 1;
         }
     }
@@ -207,8 +208,8 @@
     lyb_read((uint8_t *)*str, len, lybctx);
 
     while (next_chunk) {
-        cur_len = LYB_LAST_SUBTREE(lybctx).written;
-        if (LYB_LAST_SUBTREE(lybctx).position) {
+        cur_len = LYB_LAST_SIBLING(lybctx).written;
+        if (LYB_LAST_SIBLING(lybctx).position) {
             next_chunk = 1;
         } else {
             next_chunk = 0;
@@ -282,46 +283,46 @@
 }
 
 /**
- * @brief Stop the current subtree - change LYB context state.
+ * @brief Stop the current "siblings" - change LYB context state.
  *
  * @param[in] lybctx LYB context.
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_read_stop_subtree(struct lylyb_ctx *lybctx)
+lyb_read_stop_siblings(struct lylyb_ctx *lybctx)
 {
-    if (LYB_LAST_SUBTREE(lybctx).written) {
+    if (LYB_LAST_SIBLING(lybctx).written) {
         LOGINT_RET(lybctx->ctx);
     }
 
-    LY_ARRAY_DECREMENT(lybctx->subtrees);
+    LY_ARRAY_DECREMENT(lybctx->siblings);
     return LY_SUCCESS;
 }
 
 /**
- * @brief Start a new subtree - change LYB context state but also read the expected metadata.
+ * @brief Start a new "siblings" - change LYB context state but also read the expected metadata.
  *
  * @param[in] lybctx LYB context.
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_read_start_subtree(struct lylyb_ctx *lybctx)
+lyb_read_start_siblings(struct lylyb_ctx *lybctx)
 {
     uint8_t meta_buf[LYB_META_BYTES];
     LY_ARRAY_COUNT_TYPE u;
 
-    u = LY_ARRAY_COUNT(lybctx->subtrees);
-    if (u == lybctx->subtree_size) {
-        LY_ARRAY_CREATE_RET(lybctx->ctx, lybctx->subtrees, u + LYB_SUBTREE_STEP, LY_EMEM);
-        lybctx->subtree_size = u + LYB_SUBTREE_STEP;
+    u = LY_ARRAY_COUNT(lybctx->siblings);
+    if (u == lybctx->sibling_size) {
+        LY_ARRAY_CREATE_RET(lybctx->ctx, lybctx->siblings, u + LYB_SIBLING_STEP, LY_EMEM);
+        lybctx->sibling_size = u + LYB_SIBLING_STEP;
     }
 
     LY_CHECK_RET(ly_in_read(lybctx->in, meta_buf, LYB_META_BYTES));
 
-    LY_ARRAY_INCREMENT(lybctx->subtrees);
-    LYB_LAST_SUBTREE(lybctx).written = meta_buf[0];
-    LYB_LAST_SUBTREE(lybctx).inner_chunks = meta_buf[LYB_SIZE_BYTES];
-    LYB_LAST_SUBTREE(lybctx).position = (LYB_LAST_SUBTREE(lybctx).written == LYB_SIZE_MAX ? 1 : 0);
+    LY_ARRAY_INCREMENT(lybctx->siblings);
+    LYB_LAST_SIBLING(lybctx).written = meta_buf[0];
+    LYB_LAST_SIBLING(lybctx).inner_chunks = meta_buf[LYB_SIZE_BYTES];
+    LYB_LAST_SIBLING(lybctx).position = (LYB_LAST_SIBLING(lybctx).written == LYB_SIZE_MAX ? 1 : 0);
 
     return LY_SUCCESS;
 }
@@ -338,24 +339,24 @@
 lyb_parse_model(struct lylyb_ctx *lybctx, uint32_t parse_options, const struct lys_module **model)
 {
     LY_ERR ret = LY_SUCCESS;
-    const struct lys_module *mod;
+    const struct lys_module *mod = NULL;
     char *mod_name = NULL, mod_rev[LY_REV_SIZE];
-    uint16_t rev;
+    uint16_t rev, length;
 
-    *model = NULL;
+    lyb_read_number(&length, 2, 2, lybctx);
 
-    /* model name */
-    ret = lyb_read_string(&mod_name, 1, lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
+    if (length) {
+        mod_name = malloc((length + 1) * sizeof *mod_name);
+        LY_CHECK_ERR_RET(!mod_name, LOGMEM(lybctx->ctx), LY_EMEM);
+        lyb_read(((uint8_t *)mod_name), length, lybctx);
+        mod_name[length] = '\0';
+    } else {
+        goto cleanup;
+    }
 
     /* revision */
     lyb_read_number(&rev, sizeof rev, 2, lybctx);
 
-    if (!mod_name[0]) {
-        /* opaq node, no module */
-        goto cleanup;
-    }
-
     if (rev) {
         sprintf(mod_rev, "%04u-%02u-%02u", ((rev & LYB_REV_YEAR_MASK) >> LYB_REV_YEAR_SHIFT) + LYB_REV_YEAR_OFFSET,
                 (rev & LYB_REV_MONTH_MASK) >> LYB_REV_MONTH_SHIFT, rev & LYB_REV_DAY_MASK);
@@ -400,9 +401,8 @@
         lyb_cache_module_hash(mod);
     }
 
-    *model = mod;
-
 cleanup:
+    *model = mod;
     free(mod_name);
     return ret;
 }
@@ -428,7 +428,7 @@
 
     /* read attributes */
     for (i = 0; i < count; ++i) {
-        ret = lyb_read_start_subtree(lybctx->lybctx);
+        ret = lyb_read_start_siblings(lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* find model */
@@ -438,9 +438,9 @@
         if (!mod) {
             /* skip it */
             do {
-                lyb_read(NULL, LYB_LAST_SUBTREE(lybctx->lybctx).written, lybctx->lybctx);
-            } while (LYB_LAST_SUBTREE(lybctx->lybctx).written);
-            goto stop_subtree;
+                lyb_read(NULL, LYB_LAST_SIBLING(lybctx->lybctx).written, lybctx->lybctx);
+            } while (LYB_LAST_SIBLING(lybctx->lybctx).written);
+            goto stop_sibling;
         }
 
         /* meta name */
@@ -466,8 +466,8 @@
 
         LY_CHECK_GOTO(ret, cleanup);
 
-stop_subtree:
-        ret = lyb_read_stop_subtree(lybctx->lybctx);
+stop_sibling:
+        ret = lyb_read_stop_siblings(lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
     }
 
@@ -567,7 +567,7 @@
 
     /* read attributes */
     for (i = 0; i < count; ++i) {
-        ret = lyb_read_start_subtree(lybctx);
+        ret = lyb_read_start_siblings(lybctx);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* prefix, may be empty */
@@ -620,7 +620,7 @@
             *attr = attr2;
         }
 
-        ret = lyb_read_stop_subtree(lybctx);
+        ret = lyb_read_stop_siblings(lybctx);
         LY_CHECK_GOTO(ret, cleanup);
     }
 
@@ -729,6 +729,8 @@
     uint32_t getnext_opts;
     uint8_t hash_count;
 
+    *snode = NULL;
+
     ret = lyb_read_hashes(lybctx->lybctx, hash, &hash_count);
     LY_CHECK_RET(ret);
 
@@ -737,7 +739,6 @@
         return LY_SUCCESS;
     }
 
-    *snode = NULL;
     getnext_opts = lybctx->int_opts & LYD_INTOPT_REPLY ? LYS_GETNEXT_OUTPUT : 0;
 
     /* find our node with matching hashes */
@@ -780,20 +781,20 @@
 }
 
 /**
- * @brief Read until the end of the current subtree.
+ * @brief Read until the end of the current siblings.
  *
  * @param[in] lybctx LYB context.
  */
 static void
-lyb_skip_subtree(struct lylyb_ctx *lybctx)
+lyb_skip_siblings(struct lylyb_ctx *lybctx)
 {
     do {
         /* first skip any meta information inside */
-        ly_in_skip(lybctx->in, LYB_LAST_SUBTREE(lybctx).inner_chunks * LYB_META_BYTES);
+        ly_in_skip(lybctx->in, LYB_LAST_SIBLING(lybctx).inner_chunks * LYB_META_BYTES);
 
         /* then read data */
-        lyb_read(NULL, LYB_LAST_SUBTREE(lybctx).written, lybctx);
-    } while (LYB_LAST_SUBTREE(lybctx).written);
+        lyb_read(NULL, LYB_LAST_SIBLING(lybctx).written, lybctx);
+    } while (LYB_LAST_SIBLING(lybctx).written);
 }
 
 /**
@@ -842,7 +843,7 @@
  * Also if needed, correct @p first_p.
  *
  * @param[in] lybctx LYB context.
- * @param[in] parent Data parent of the subtree, must be set if @p first_p is not.
+ * @param[in] parent Data parent of the sibling, must be set if @p first_p is not.
  * @param[in,out] node Parsed node to insertion.
  * @param[in,out] first_p First top-level sibling, must be set if @p parent is not.
  * @param[out] parsed Set of all successfully parsed nodes.
@@ -868,7 +869,7 @@
  * @brief Finish parsing the opaq node.
  *
  * @param[in] lybctx LYB context.
- * @param[in] parent Data parent of the subtree, must be set if @p first_p is not.
+ * @param[in] parent Data parent of the sibling, must be set if @p first_p is not.
  * @param[in] flags Node flags to set.
  * @param[in,out] attr Attributes to be attached. Finally set to NULL.
  * @param[in,out] node Parsed opaq node to finish.
@@ -901,7 +902,7 @@
  * @brief Finish parsing the node.
  *
  * @param[in] lybctx LYB context.
- * @param[in] parent Data parent of the subtree, must be set if @p first_p is not.
+ * @param[in] parent Data parent of the sibling, must be set if @p first_p is not.
  * @param[in] flags Node flags to set.
  * @param[in,out] meta Metadata to be attached. Finally set to NULL.
  * @param[in,out] node Parsed node to finish.
@@ -998,7 +999,7 @@
  * @brief Parse opaq node.
  *
  * @param[in] lybctx LYB context.
- * @param[in] parent Data parent of the subtree.
+ * @param[in] parent Data parent of the sibling.
  * @param[in,out] first_p First top-level sibling.
  * @param[out] parsed Set of all successfully parsed nodes.
  * @return LY_ERR value.
@@ -1016,12 +1017,6 @@
     const struct ly_ctx *ctx = lybctx->lybctx->ctx;
     uint32_t flags;
 
-    if (!(lybctx->parse_opts & LYD_PARSE_OPAQ)) {
-        /* unknown data, skip them */
-        lyb_skip_subtree(lybctx->lybctx);
-        return LY_SUCCESS;
-    }
-
     /* parse opaq node attributes */
     ret = lyb_parse_attributes(lybctx->lybctx, &attr);
     LY_CHECK_GOTO(ret, cleanup);
@@ -1053,16 +1048,30 @@
     ret = lyb_parse_prefix_data(lybctx->lybctx, format, &val_prefix_data);
     LY_CHECK_GOTO(ret, cleanup);
 
+    if (!(lybctx->parse_opts & LYD_PARSE_OPAQ)) {
+        if (lybctx->lybctx->in->current[0] == 0) {
+            /* opaq node has no children */
+            lyb_read(NULL, 1, lybctx->lybctx);
+        } else {
+            /* skip children */
+            ret = lyb_read_start_siblings(lybctx->lybctx);
+            LY_CHECK_RET(ret);
+            lyb_skip_siblings(lybctx->lybctx);
+            ret = lyb_read_stop_siblings(lybctx->lybctx);
+            LY_CHECK_RET(ret);
+        }
+
+        goto cleanup;
+    }
+
     /* create node */
     ret = lyd_create_opaq(ctx, name, strlen(name), prefix, ly_strlen(prefix), module_key, ly_strlen(module_key),
             value, strlen(value), &dynamic, format, val_prefix_data, 0, &node);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* process children */
-    while (LYB_LAST_SUBTREE(lybctx->lybctx).written) {
-        ret = lyb_parse_subtree_r(lybctx, node, NULL, NULL);
-        LY_CHECK_GOTO(ret, cleanup);
-    }
+    ret = lyb_parse_siblings(lybctx, node, NULL, NULL);
+    LY_CHECK_GOTO(ret, cleanup);
 
     /* register parsed opaq node */
     lyb_finish_opaq(lybctx, parent, flags, &attr, &node, first_p, parsed);
@@ -1085,7 +1094,7 @@
  * @brief Parse anydata or anyxml node.
  *
  * @param[in] lybctx LYB context.
- * @param[in] parent Data parent of the subtree.
+ * @param[in] parent Data parent of the sibling.
  * @param[in] snode Schema of the node to be parsed.
  * @param[in,out] first_p First top-level sibling.
  * @param[out] parsed Set of all successfully parsed nodes.
@@ -1105,8 +1114,7 @@
     const struct ly_ctx *ctx = lybctx->lybctx->ctx;
 
     /* read necessary basic data */
-    ret = lyb_parse_node_header(lybctx, &flags, &meta);
-    LY_CHECK_GOTO(ret, error);
+    lyb_parse_node_header(lybctx, &flags, &meta);
 
     /* parse value type */
     lyb_read_number(&value_type, sizeof value_type, sizeof value_type, lybctx->lybctx);
@@ -1118,7 +1126,7 @@
     }
 
     /* read anydata content */
-    ret = lyb_read_string(&value, 0, lybctx->lybctx);
+    ret = lyb_read_string(&value, 1, lybctx->lybctx);
     LY_CHECK_GOTO(ret, error);
 
     if (value_type == LYD_ANYDATA_LYB) {
@@ -1196,66 +1204,30 @@
 }
 
 /**
- * @brief Parse model and hash.
+ * @brief Parse LYB node with children.
  *
  * @param[in] lybctx LYB context.
- * @param[in] parent Data parent of the subtree.
- * @param[out] snode Schema of the node to be further parsed. Can be NULL for the opaq node.
- * @return LY_ERR value.
- */
-static LY_ERR
-lyb_print_model_and_hash(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, const struct lysc_node **snode)
-{
-    LY_ERR ret;
-    const struct lys_module *mod;
-
-    if (!parent || !parent->schema) {
-        /* top-level or opaque, read module name */
-        ret = lyb_parse_model(lybctx->lybctx, lybctx->parse_opts, &mod);
-        LY_CHECK_RET(ret);
-
-        /* read hash, find the schema node starting from mod */
-        ret = lyb_parse_schema_hash(lybctx, NULL, mod, snode);
-        LY_CHECK_RET(ret);
-    } else {
-        /* read hash, find the schema node starting from parent schema */
-        ret = lyb_parse_schema_hash(lybctx, parent->schema, NULL, snode);
-        LY_CHECK_RET(ret);
-    }
-
-    return ret;
-}
-
-/**
- * @brief Parse LYB subtree.
- *
- * @param[in] lybctx LYB context.
- * @param[in] parent Data parent of the subtree, must be set if @p first is not.
+ * @param[in] parent Data parent of the sibling, must be set if @p first is not.
+ * @param[in] snode Schema of the node to be parsed.
  * @param[in,out] first_p First top-level sibling, must be set if @p parent is not.
  * @param[out] parsed Set of all successfully parsed nodes.
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_parse_subtree_r(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, struct lyd_node **first_p, struct ly_set *parsed)
+lyb_parse_node(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, const struct lysc_node *snode,
+        struct lyd_node **first_p, struct ly_set *parsed)
 {
     LY_ERR ret = LY_SUCCESS;
     struct lyd_node *node = NULL;
-    const struct lysc_node *snode = NULL;
     struct lyd_meta *meta = NULL;
     uint32_t flags;
     const struct ly_ctx *ctx = lybctx->lybctx->ctx;
 
-    /* register a new subtree */
-    LY_CHECK_GOTO(ret = lyb_read_start_subtree(lybctx->lybctx), cleanup);
-
-    ret = lyb_print_model_and_hash(lybctx, parent, &snode);
-    LY_CHECK_RET(ret);
-
     if (!snode) {
         ret = lyb_parse_node_opaq(lybctx, parent, first_p, parsed);
         LY_CHECK_GOTO(ret, cleanup);
-        goto stop_subtree;
     } else if (snode->nodetype & LYD_NODE_TERM) {
+        /* read necessary basic data */
         ret = lyb_parse_node_header(lybctx, &flags, &meta);
         LY_CHECK_GOTO(ret, cleanup);
 
@@ -1263,9 +1235,9 @@
         ret = lyb_create_term(lybctx, snode, &node);
         LY_CHECK_GOTO(ret, cleanup);
 
-        /* complete the node processing */
         lyb_finish_node(lybctx, parent, flags, &meta, &node, first_p, parsed);
     } else if (snode->nodetype & LYD_NODE_INNER) {
+        /* read necessary basic data */
         ret = lyb_parse_node_header(lybctx, &flags, &meta);
         LY_CHECK_GOTO(ret, cleanup);
 
@@ -1274,10 +1246,8 @@
         LY_CHECK_GOTO(ret, cleanup);
 
         /* process children */
-        while (LYB_LAST_SUBTREE(lybctx->lybctx).written) {
-            ret = lyb_parse_subtree_r(lybctx, node, NULL, NULL);
-            LY_CHECK_GOTO(ret, cleanup);
-        }
+        ret = lyb_parse_siblings(lybctx, node, NULL, NULL);
+        LY_CHECK_GOTO(ret, cleanup);
 
         /* additional procedure for inner node */
         ret = lyb_validate_node_inner(lybctx, snode, node);
@@ -1288,23 +1258,17 @@
             lybctx->op_node = node;
         }
 
-        /* complete the node processing */
+        /* register parsed node */
         lyb_finish_node(lybctx, parent, flags, &meta, &node, first_p, parsed);
     } else if (snode->nodetype & LYD_NODE_ANY) {
         ret = lyb_parse_node_any(lybctx, parent, snode, first_p, parsed);
         LY_CHECK_GOTO(ret, cleanup);
-        goto stop_subtree;
     } else {
         LOGINT(ctx);
         ret = LY_EINT;
         goto cleanup;
     }
 
-stop_subtree:
-    /* end the subtree */
-    ret = lyb_read_stop_subtree(lybctx->lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
 cleanup:
     lyd_free_meta_siblings(meta);
     lyd_free_tree(node);
@@ -1312,6 +1276,64 @@
 }
 
 /**
+ * @brief Parse siblings (@ref lyb_print_siblings()).
+ *
+ * @param[in] lybctx LYB context.
+ * @param[in] parent Data parent of the sibling, must be set if @p first_p is not.
+ * @param[in,out] first_p First top-level sibling, must be set if @p parent is not.
+ * @param[out] parsed Set of all successfully parsed nodes.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lyb_parse_siblings(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, struct lyd_node **first_p,
+        struct ly_set *parsed)
+{
+    LY_ERR ret;
+    const struct lysc_node *snode;
+    const struct lys_module *mod;
+    ly_bool top_level;
+
+    if (lybctx->lybctx->in->current[0] == 0) {
+        lyb_read(NULL, 1, lybctx->lybctx);
+        return LY_SUCCESS;
+    }
+
+    top_level = !LY_ARRAY_COUNT(lybctx->lybctx->siblings);
+
+    /* register a new siblings */
+    ret = lyb_read_start_siblings(lybctx->lybctx);
+    LY_CHECK_RET(ret);
+
+    while (LYB_LAST_SIBLING(lybctx->lybctx).written) {
+        if (!parent || !parent->schema) {
+            /* top-level or opaque, read module name */
+            ret = lyb_parse_model(lybctx->lybctx, lybctx->parse_opts, &mod);
+            LY_CHECK_RET(ret);
+
+            /* read hash, find the schema node starting from mod */
+            ret = lyb_parse_schema_hash(lybctx, NULL, mod, &snode);
+        } else {
+            /* read hash, find the schema node starting from parent schema */
+            ret = lyb_parse_schema_hash(lybctx, parent->schema, NULL, &snode);
+        }
+        LY_CHECK_RET(ret);
+
+        lyb_parse_node(lybctx, parent, snode, first_p, parsed);
+        LY_CHECK_RET(ret);
+
+        if (top_level && !(lybctx->int_opts & LYD_INTOPT_WITH_SIBLINGS)) {
+            break;
+        }
+    }
+
+    /* end the siblings */
+    ret = lyb_read_stop_siblings(lybctx->lybctx);
+    LY_CHECK_RET(ret);
+
+    return ret;
+}
+
+/**
  * @brief Parse used YANG data models.
  *
  * @param[in] lybctx LYB context.
@@ -1436,15 +1458,9 @@
     rc = lyb_parse_data_models(lybctx->lybctx, lybctx->parse_opts);
     LY_CHECK_GOTO(rc, cleanup);
 
-    /* read subtree(s) */
-    while (lybctx->lybctx->in->current[0]) {
-        rc = lyb_parse_subtree_r(lybctx, parent, first_p, parsed);
-        LY_CHECK_GOTO(rc, cleanup);
-
-        if (!(int_opts & LYD_INTOPT_WITH_SIBLINGS)) {
-            break;
-        }
-    }
+    /* read sibling(s) */
+    rc = lyb_parse_siblings(lybctx, parent, first_p, parsed);
+    LY_CHECK_GOTO(rc, cleanup);
 
     if ((int_opts & LYD_INTOPT_NO_SIBLINGS) && lybctx->lybctx->in->current[0]) {
         LOGVAL(ctx, LYVE_SYNTAX, "Unexpected sibling node.");
@@ -1546,17 +1562,19 @@
         lyb_read(buf, 2, lybctx);
     }
 
-    while (lybctx->in->current[0]) {
-        /* register a new subtree */
-        ret = lyb_read_start_subtree(lybctx);
+    if (lybctx->in->current[0]) {
+        /* register a new sibling */
+        ret = lyb_read_start_siblings(lybctx);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* skip it */
-        lyb_skip_subtree(lybctx);
+        lyb_skip_siblings(lybctx);
 
-        /* subtree finished */
-        ret = lyb_read_stop_subtree(lybctx);
+        /* sibling finished */
+        ret = lyb_read_stop_siblings(lybctx);
         LY_CHECK_GOTO(ret, cleanup);
+    } else {
+        lyb_read(NULL, 1, lybctx);
     }
 
     /* read the last zero, parsing finished */
