Refactor of min and max to support strict comparison and any type with an ordering