lda base code implemented