added codebook details, variables
added write final table