Updated the builder to filter by hierarchy correctly.