updated inversion code, now runs through various values of lambda