added produce_mk_tree function