recursive min max added