better caching, cleanup