use a flat array as hierarchical data