minmax_stack working