caching the end of some containers, optimizing