added caching functionallity