Minor code reorganization.
Adds support for cacheing of arbitary per-item data.