Added logic to only show a group if it has children