Bug in LDAUtils and some refactoring of MainClass