change the interface of min/max so that they return an option
in case the sequence is empty