add min and max method