Simplified LDA code