Added Javadoc and made small API extensions.