adding min and max