finished batch lda helper functions