Finished implementation of JNI part