added better support for caching