Refactor NativeLibrary a little