Standardize the category and notcategory parameter names.  Move error checking to its own function and started work on it.