clean up codebook