Fixed minor bugs. Updated javadoc.