Added caching system to the codebook