Code refactor and minimal JAVA doc refactor.