added rough thumbnail caching code