updated to work with category.