Remove self-referential nesting of categories