Implemented a tree-like structure