redesign the rescale_outputs func