Misc changes while playing with the library

Please double-check my Java code, I have been unable to test this locally.