iter: add max and min functions