Getting the codebook