Added javadoc and cleaned up packages.