diff --git a/src/lyb.h b/src/lyb.h
index 5c9077d..42c5d1e 100644
--- a/src/lyb.h
+++ b/src/lyb.h
@@ -33,12 +33,12 @@
 
     const struct lys_module **models;
 
-    struct lyd_lyb_subtree {
+    struct lyd_lyb_sibling {
         size_t written;
         size_t position;
         uint8_t inner_chunks;
-    } *subtrees;
-    LY_ARRAY_COUNT_TYPE subtree_size;
+    } *siblings;
+    LY_ARRAY_COUNT_TYPE sibling_size;
 
     /* LYB printer only */
     struct lyd_lyb_sib_ht {
@@ -62,12 +62,12 @@
  * an array of hashes is created with each next hash one bit shorter until a unique sequence of all these
  * hashes is found and then all of them are stored.
  *
- * - tree structure is represented as individual strictly bounded subtrees. Each subtree begins
- * with its metadata, which consist of 1) the whole subtree length in bytes and 2) number
- * of included metadata chunks of nested subtrees.
+ * - tree structure is represented as individual strictly bounded "siblings". Each "siblings" begins
+ * with its metadata, which consist of 1) the whole "sibling" length in bytes and 2) number
+ * of included metadata chunks of nested "siblings".
  *
- * - since length of a subtree is not known before it is printed, holes are first written and
- * after the subtree is printed, they are filled with actual valid metadata. As a consequence,
+ * - since length of a "sibling" is not known before it is printed, holes are first written and
+ * after the "sibling" is printed, they are filled with actual valid metadata. As a consequence,
  * LYB data cannot be directly printed into streams!
  *
  * - data are preceded with information about all the used modules. It is needed because of
@@ -76,10 +76,10 @@
  */
 
 /* just a shortcut */
-#define LYB_LAST_SUBTREE(lybctx) lybctx->subtrees[LY_ARRAY_COUNT(lybctx->subtrees) - 1]
+#define LYB_LAST_SIBLING(lybctx) lybctx->siblings[LY_ARRAY_COUNT(lybctx->siblings) - 1]
 
-/* struct lyd_lyb_subtree allocation step */
-#define LYB_SUBTREE_STEP 4
+/* struct lyd_lyb_sibling allocation step */
+#define LYB_SIBLING_STEP 4
 
 /* current LYB format version */
 #define LYB_VERSION_NUM 0x10
@@ -143,9 +143,6 @@
 #define LYB_REV_MONTH_SHIFT 5
 #define LYB_REV_DAY_MASK    0x001fU
 
-/* Type large enough for all meta data */
-#define LYB_META uint16_t
-
 /**
  * @brief Get single hash for a schema node to be used for LYB data. Read from cache, if possible.
  *
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 */
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index 72e0700..0b6a48a 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -40,7 +40,7 @@
 
 static LY_ERR lyb_print_schema_hash(struct ly_out *out, struct lysc_node *schema, struct hash_table **sibling_ht, struct lylyb_ctx *lybctx);
 static LY_ERR lyb_print_attributes(struct ly_out *out, const struct lyd_node_opaq *node, struct lylyb_ctx *lybctx);
-static LY_ERR lyb_print_subtree(struct ly_out *out, const struct lyd_node *node, struct hash_table **sibling_ht, struct lyd_lyb_ctx *lybctx);
+static LY_ERR lyb_print_siblings(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx);
 static LY_ERR lyb_print_node_header(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx);
 
 /**
@@ -242,7 +242,7 @@
 lyb_write(struct ly_out *out, const uint8_t *buf, size_t count, struct lylyb_ctx *lybctx)
 {
     LY_ARRAY_COUNT_TYPE u;
-    struct lyd_lyb_subtree *full, *iter;
+    struct lyd_lyb_sibling *full, *iter;
     size_t to_write;
     uint8_t meta_buf[LYB_META_BYTES];
 
@@ -250,12 +250,12 @@
         /* check for full data chunks */
         to_write = count;
         full = NULL;
-        LY_ARRAY_FOR(lybctx->subtrees, u) {
+        LY_ARRAY_FOR(lybctx->siblings, u) {
             /* we want the innermost chunks resolved first, so replace previous full chunks */
-            if (lybctx->subtrees[u].written + to_write >= LYB_SIZE_MAX) {
+            if (lybctx->siblings[u].written + to_write >= LYB_SIZE_MAX) {
                 /* full chunk, do not write more than allowed */
-                to_write = LYB_SIZE_MAX - lybctx->subtrees[u].written;
-                full = &lybctx->subtrees[u];
+                to_write = LYB_SIZE_MAX - lybctx->siblings[u].written;
+                full = &lybctx->siblings[u];
             }
         }
 
@@ -267,10 +267,10 @@
         if (to_write) {
             LY_CHECK_RET(ly_write_(out, (char *)buf, to_write));
 
-            LY_ARRAY_FOR(lybctx->subtrees, u) {
+            LY_ARRAY_FOR(lybctx->siblings, u) {
                 /* increase all written counters */
-                lybctx->subtrees[u].written += to_write;
-                assert(lybctx->subtrees[u].written <= LYB_SIZE_MAX);
+                lybctx->siblings[u].written += to_write;
+                assert(lybctx->siblings[u].written <= LYB_SIZE_MAX);
             }
             /* decrease count/buf */
             count -= to_write;
@@ -291,7 +291,7 @@
             LY_CHECK_RET(ly_write_skip(out, LYB_META_BYTES, &full->position));
 
             /* increase inner chunk count */
-            for (iter = &lybctx->subtrees[0]; iter != full; ++iter) {
+            for (iter = &lybctx->siblings[0]; iter != full; ++iter) {
                 if (iter->inner_chunks == LYB_INCHUNK_MAX) {
                     LOGINT(lybctx->ctx);
                     return LY_EINT;
@@ -305,58 +305,58 @@
 }
 
 /**
- * @brief Stop the current subtree - write its final metadata.
+ * @brief Stop the current "siblings" - write its final metadata.
  *
  * @param[in] out Out structure.
  * @param[in] lybctx LYB context.
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_write_stop_subtree(struct ly_out *out, struct lylyb_ctx *lybctx)
+lyb_write_stop_siblings(struct ly_out *out, struct lylyb_ctx *lybctx)
 {
     uint8_t meta_buf[LYB_META_BYTES];
 
     /* write the meta chunk information */
-    meta_buf[0] = LYB_LAST_SUBTREE(lybctx).written & LYB_BYTE_MASK;
-    meta_buf[1] = LYB_LAST_SUBTREE(lybctx).inner_chunks & LYB_BYTE_MASK;
-    LY_CHECK_RET(ly_write_skipped(out, LYB_LAST_SUBTREE(lybctx).position, (char *)&meta_buf, LYB_META_BYTES));
+    meta_buf[0] = LYB_LAST_SIBLING(lybctx).written & LYB_BYTE_MASK;
+    meta_buf[1] = LYB_LAST_SIBLING(lybctx).inner_chunks & LYB_BYTE_MASK;
+    LY_CHECK_RET(ly_write_skipped(out, LYB_LAST_SIBLING(lybctx).position, (char *)&meta_buf, LYB_META_BYTES));
 
-    LY_ARRAY_DECREMENT(lybctx->subtrees);
+    LY_ARRAY_DECREMENT(lybctx->siblings);
     return LY_SUCCESS;
 }
 
 /**
- * @brief Start a new subtree - skip bytes for its metadata.
+ * @brief Start a new "siblings" - skip bytes for its metadata.
  *
  * @param[in] out Out structure.
  * @param[in] lybctx LYB context.
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_write_start_subtree(struct ly_out *out, struct lylyb_ctx *lybctx)
+lyb_write_start_siblings(struct ly_out *out, struct lylyb_ctx *lybctx)
 {
     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_ARRAY_INCREMENT(lybctx->subtrees);
-    LYB_LAST_SUBTREE(lybctx).written = 0;
-    LYB_LAST_SUBTREE(lybctx).inner_chunks = 0;
+    LY_ARRAY_INCREMENT(lybctx->siblings);
+    LYB_LAST_SIBLING(lybctx).written = 0;
+    LYB_LAST_SIBLING(lybctx).inner_chunks = 0;
 
     /* another inner chunk */
-    for (u = 0; u < LY_ARRAY_COUNT(lybctx->subtrees) - 1; ++u) {
-        if (lybctx->subtrees[u].inner_chunks == LYB_INCHUNK_MAX) {
+    for (u = 0; u < LY_ARRAY_COUNT(lybctx->siblings) - 1; ++u) {
+        if (lybctx->siblings[u].inner_chunks == LYB_INCHUNK_MAX) {
             LOGINT(lybctx->ctx);
             return LY_EINT;
         }
-        ++lybctx->subtrees[u].inner_chunks;
+        ++lybctx->siblings[u].inner_chunks;
     }
 
-    LY_CHECK_RET(ly_write_skip(out, LYB_META_BYTES, &LYB_LAST_SUBTREE(lybctx).position));
+    LY_CHECK_RET(ly_write_skip(out, LYB_META_BYTES, &LYB_LAST_SIBLING(lybctx).position));
 
     return LY_SUCCESS;
 }
@@ -431,7 +431,8 @@
     if (mod) {
         LY_CHECK_RET(lyb_write_string(mod->name, 0, 1, out, lybctx));
     } else {
-        LY_CHECK_RET(lyb_write_string("", 0, 1, out, lybctx));
+        lyb_write_number(0, 2, out, lybctx);
+        return LY_SUCCESS;
     }
 
     /* model revision as XXXX XXXX XXXX XXXX (2B) (year is offset from 2000)
@@ -624,8 +625,6 @@
 static LY_ERR
 lyb_print_node_opaq(struct ly_out *out, const struct lyd_node_opaq *opaq, struct lyd_lyb_ctx *lyd_lybctx)
 {
-    const struct lyd_node *node;
-    struct hash_table *child_ht = NULL;
     struct lylyb_ctx *lybctx = lyd_lybctx->lybctx;
 
     /* write attributes */
@@ -653,9 +652,7 @@
     LY_CHECK_RET(lyb_print_prefix_data(out, opaq->format, opaq->val_prefix_data, lybctx));
 
     /* recursively write all the descendants */
-    LY_LIST_FOR(lyd_child((struct lyd_node *)opaq), node) {
-        LY_CHECK_RET(lyb_print_subtree(out, node, &child_ht, lyd_lybctx));
-    }
+    LY_CHECK_RET(lyb_print_siblings(out, opaq->child, lyd_lybctx));
 
     return LY_SUCCESS;
 }
@@ -710,7 +707,7 @@
     }
 
     /* followed by the content */
-    LY_CHECK_GOTO(ret = lyb_write_string(str, (size_t)len, 0, out, lybctx), cleanup);
+    LY_CHECK_GOTO(ret = lyb_write_string(str, (size_t)len, 1, out, lybctx), cleanup);
 
 cleanup:
     ly_out_free(out2, NULL, 1);
@@ -829,17 +826,17 @@
 
     if (wd_mod) {
         /* write the "default" metadata */
-        LY_CHECK_RET(lyb_write_start_subtree(out, lybctx->lybctx));
+        LY_CHECK_RET(lyb_write_start_siblings(out, lybctx->lybctx));
         LY_CHECK_RET(lyb_print_model(out, wd_mod, lybctx->lybctx));
         LY_CHECK_RET(lyb_write_string("default", 0, 1, out, lybctx->lybctx));
         LY_CHECK_RET(lyb_write_string("true", 0, 0, out, lybctx->lybctx));
-        LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx->lybctx));
+        LY_CHECK_RET(lyb_write_stop_siblings(out, lybctx->lybctx));
     }
 
     /* write all the node metadata */
     LY_LIST_FOR(node->meta, iter) {
-        /* each metadata is a subtree */
-        LY_CHECK_RET(lyb_write_start_subtree(out, lybctx->lybctx));
+        /* each metadata is a sibling */
+        LY_CHECK_RET(lyb_write_start_siblings(out, lybctx->lybctx));
 
         /* model */
         LY_CHECK_RET(lyb_print_model(out, iter->annotation->module, lybctx->lybctx));
@@ -850,8 +847,8 @@
         /* metadata value */
         LY_CHECK_RET(lyb_write_string(lyd_get_meta_value(iter), 0, 0, out, lybctx->lybctx));
 
-        /* finish metadata subtree */
-        LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx->lybctx));
+        /* finish metadata sibling */
+        LY_CHECK_RET(lyb_write_stop_siblings(out, lybctx->lybctx));
     }
 
     return LY_SUCCESS;
@@ -884,8 +881,8 @@
 
     /* write all the attributes */
     LY_LIST_FOR(node->attr, iter) {
-        /* each attribute is a subtree */
-        LY_CHECK_RET(lyb_write_start_subtree(out, lybctx));
+        /* each attribute is a sibling */
+        LY_CHECK_RET(lyb_write_start_siblings(out, lybctx));
 
         /* prefix */
         LY_CHECK_RET(lyb_write_string(iter->name.prefix, 0, 1, out, lybctx));
@@ -905,8 +902,8 @@
         /* value */
         LY_CHECK_RET(lyb_write_string(iter->value, 0, 0, out, lybctx));
 
-        /* finish attribute subtree */
-        LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx));
+        /* finish attribute sibling */
+        LY_CHECK_RET(lyb_write_stop_siblings(out, lybctx));
     }
 
     return LY_SUCCESS;
@@ -933,32 +930,6 @@
 }
 
 /**
- * @brief Print model and hash.
- *
- * @param[in] out Out structure.
- * @param[in] node Current data node to print.
- * @param[in,out] sibling_ht Cached hash table for these siblings, created if NULL.
- * @param[in] lybctx LYB context.
- * @return LY_ERR value.
- */
-static LY_ERR
-lyb_print_model_and_hash(struct ly_out *out, const struct lyd_node *node, struct hash_table **sibling_ht,
-        struct lylyb_ctx *lybctx)
-{
-    /* write model info first, for all opaque and top-level nodes */
-    if (!node->schema && (!node->parent || !node->parent->schema)) {
-        LY_CHECK_RET(lyb_print_model(out, NULL, lybctx));
-    } else if (node->schema && !lysc_data_parent(node->schema)) {
-        LY_CHECK_RET(lyb_print_model(out, node->schema->module, lybctx));
-    }
-
-    /* write schema hash */
-    LY_CHECK_RET(lyb_print_schema_hash(out, (struct lysc_node *)node->schema, sibling_ht, lybctx));
-
-    return LY_SUCCESS;
-}
-
-/**
  * @brief Print schema node hash.
  *
  * @param[in] out Out structure.
@@ -1036,48 +1007,89 @@
 }
 
 /**
- * @brief Print data subtree.
+ * @brief Print node with childs.
  *
  * @param[in] out Out structure.
- * @param[in] node Root node of the subtree to print.
- * @param[in,out] sibling_ht Cached hash table for these data siblings, created if NULL.
+ * @param[in] node Root node of the sibling to print.
  * @param[in] lybctx LYB context.
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_print_subtree(struct ly_out *out, const struct lyd_node *node, struct hash_table **sibling_ht, struct lyd_lyb_ctx *lybctx)
+lyb_print_node(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx)
 {
-    struct hash_table *child_ht = NULL;
-
-    /* register a new subtree */
-    LY_CHECK_RET(lyb_write_start_subtree(out, lybctx->lybctx));
-
-    LY_CHECK_RET(lyb_print_model_and_hash(out, node, sibling_ht, lybctx->lybctx));
-
     /* write node content */
     if (!node->schema) {
         LY_CHECK_RET(lyb_print_node_opaq(out, (struct lyd_node_opaq *)node, lybctx));
-        goto stop_subtree;
     } else if (node->schema->nodetype & LYD_NODE_INNER) {
+        /* write necessary basic data */
         LY_CHECK_RET(lyb_print_node_header(out, node, lybctx));
+
+        /* recursively write all the descendants */
+        LY_CHECK_RET(lyb_print_siblings(out, lyd_child(node), lybctx));
     } else if (node->schema->nodetype & LYD_NODE_TERM) {
         LY_CHECK_RET(lyb_print_node_header(out, node, lybctx));
         LY_CHECK_RET(lyb_print_term_value((struct lyd_node_term *)node, out, lybctx->lybctx));
     } else if (node->schema->nodetype & LYD_NODE_ANY) {
         LY_CHECK_RET(lyb_print_node_any(out, (struct lyd_node_any *)node, lybctx));
-        goto stop_subtree;
     } else {
         LOGINT_RET(lybctx->lybctx->ctx);
     }
 
-    /* recursively write all the descendants */
-    LY_LIST_FOR(lyd_child(node), node) {
-        LY_CHECK_RET(lyb_print_subtree(out, node, &child_ht, lybctx));
+    return LY_SUCCESS;
+}
+
+/**
+ * @brief Print siblings.
+ *
+ * @param[in] out Out structure.
+ * @param[in] node Current data node to print.
+ * @param[in] lybctx LYB context.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lyb_print_siblings(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx)
+{
+    struct hash_table *sibling_ht = NULL;
+    const struct lys_module *prev_mod = NULL;
+    ly_bool top_level;
+    uint8_t zero = 0;
+
+    if (!node) {
+        lyb_write(out, &zero, 1, lybctx->lybctx);
+        return LY_SUCCESS;
     }
 
-stop_subtree:
-    /* finish this subtree */
-    LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx->lybctx));
+    top_level = !LY_ARRAY_COUNT(lybctx->lybctx->siblings);
+
+    LY_CHECK_RET(lyb_write_start_siblings(out, lybctx->lybctx));
+
+    /* write all the siblings */
+    LY_LIST_FOR(node, node) {
+
+        /* do not reuse sibling hash tables from different modules */
+        if (top_level && (!node->schema || (node->schema->module != prev_mod))) {
+            sibling_ht = NULL;
+            prev_mod = node->schema ? node->schema->module : NULL;
+        }
+
+        /* write model info first, for all opaque and top-level nodes */
+        if (!node->schema && (!node->parent || !node->parent->schema)) {
+            LY_CHECK_RET(lyb_print_model(out, NULL, lybctx->lybctx));
+        } else if (node->schema && !lysc_data_parent(node->schema)) {
+            LY_CHECK_RET(lyb_print_model(out, node->schema->module, lybctx->lybctx));
+        }
+
+        /* write schema hash */
+        LY_CHECK_RET(lyb_print_schema_hash(out, (struct lysc_node *)node->schema, &sibling_ht, lybctx->lybctx));
+
+        LY_CHECK_RET(lyb_print_node(out, node, lybctx));
+
+        if (top_level && !(lybctx->print_options & LYD_PRINT_WITHSIBLINGS)) {
+            break;
+        }
+    }
+
+    LY_CHECK_RET(lyb_write_stop_siblings(out, lybctx->lybctx));
 
     return LY_SUCCESS;
 }
@@ -1087,8 +1099,6 @@
 {
     LY_ERR ret = LY_SUCCESS;
     uint8_t zero = 0;
-    struct hash_table *top_sibling_ht = NULL;
-    const struct lys_module *prev_mod = NULL;
     struct lyd_lyb_ctx *lybctx;
     const struct ly_ctx *ctx = root ? LYD_CTX(root) : NULL;
 
@@ -1117,19 +1127,8 @@
     /* all used models */
     LY_CHECK_GOTO(ret = lyb_print_data_models(out, root, lybctx->lybctx), cleanup);
 
-    LY_LIST_FOR(root, root) {
-        /* do not reuse sibling hash tables from different modules */
-        if (!root->schema || (root->schema->module != prev_mod)) {
-            top_sibling_ht = NULL;
-            prev_mod = root->schema ? root->schema->module : NULL;
-        }
-
-        LY_CHECK_GOTO(ret = lyb_print_subtree(out, root, &top_sibling_ht, lybctx), cleanup);
-
-        if (!(options & LYD_PRINT_WITHSIBLINGS)) {
-            break;
-        }
-    }
+    ret = lyb_print_siblings(out, root, lybctx);
+    LY_CHECK_GOTO(ret, cleanup);
 
     /* ending zero byte */
     LY_CHECK_GOTO(ret = lyb_write(out, &zero, sizeof zero, lybctx->lybctx), cleanup);
