add java doc and other small improvements