server javadoc and minor refactoring