detect threshold via min and max values, rather than average