Some refactoring
Some more work on java module.