Improved cache: fix in-memory caching, POD improvements, code style improvements.