updated to cache the data for faster access from the document.