Refactoring.

Add Javadocs.