create hierarchical structure