Added some fixes to the codebook