support flat view and hierarchical view