Basic tree structure with some utility functions