reworked ThresholdTwoLevels (3rd try)