add commented code for min and max