Implement min() and max()