Whoops, use min instead of max.