more precision about generating codebook