How to arrange objects in a hierarchy