Added JNI implementation