Generalize min and max to work with arbitrary number of arguments