Added treshold deviation checking