LDA code improvement & removed dead code