Fix type of threshold variable in inRange function to correct type. And set stdevlimit to 4 to allow for bigger deviation from the average to be able to find more often a baseline (until now only once one error in 31-05-2014.log)