correct hierarchy building