sort of have the recursion down, now just need to get the jacobian and inverse jacobian to work correctly.