minor performance improvements with caching