Added code for simulating for stability