Updating codebook.