Changes to make LDA a bit faster