Adding some javadocs and fixing some minor issues.