pre-merge jni folder with Daniel branch

Updating C++ code with newest code