add max and min