Redesigned model cache to be more reusable.