added max and min