Finishided converting LevMarq function into a kernel