final update of codebook