Improved Jacobian calculation