starting to rewrite motif_tree