Add Javadoc and fix refactoring mess

Great, another manual merge...