Not related to this bug, but shouldn't this also use the absolute value of `secDiff`?