Use right-sibling tree to store gadgets