testPerturbationStability function pretty much complete