added thresholdModel function