general case adding when_run block