Update comments to fix some typo's and add clearification. Add check to make sure the deviation from the global maximum and minimum of the iterated part of the trace lies within the threshold. This fixes a problem where the trace could in- or decrease gradually, but still be within the threshold