added java docs
refactoring and java docs