Added the function call for writing the codebook txt file.