write a codebook