added max() and min() functionality