code cleanup

updated to grab content before item is cleaned up if cache grows too large