Javadocs and some code cleanup.