javadocs and minor refactorings