Implemented max and min.