updated loop for proper display of category page elements