Fixed R code and pdated codebook