Changing type signature of min/max to incorporate index