Moved entity caching code to new EntityCache class; other refactorings and code cleanups; no functional changes
Moved entity caching code to new EntityCache class; other refactorings and code cleanups; no functional changes