code updates

nearly completed.  + codebook