Added hierarchical factory method for creating a tree