Performance improved with new _iter_category and _iter_categories method...

Code cleanup improves performance of _iter_category and _iter_categories.  Testcases still pass.