Fixed javadoc and comments, cleaned up a bit, and tried to fix
synchronization.