adding and removing categories and patterns