API cleanup and javadoc.