adding some caching to speed up