Creating the codebook