rework of execute to allow writing of results to one of the input indexes