initial working version of smartcache