Rewritten iterative category summarized lookup.