added java native constructor + some refactoring