Added simple LDA example
Moved some common code into helper function