Adds tests and a fix for the categories/new bug.