Merge JNI-based version to master