adding the rest of the code of the chapter on LDA