Simplify the category adding code.