slightly changed the control flow of 'Run simulation'