minor refactoring, extended javadoc