creating a codebook