fixed MaxSlope so it selected the max slope (positive OR negative)