Added update codebook functionality