codebook cleanup