Commit Java prototype / fix minor issues with the C++ version