added a LRU cache. a quick test and it seems to work.