KnowledgeManager refactoring + some Java Docs

@bures