javadoc + small refactoring