Sync up mostly there

Following diffs are a bit odd.
I had some java code commented out previously and now I have the objective-c implementation.
So the diff is between java and objective-c.