Refactoring, adding a cache object