Implemented calculation of treshold as (min-max)*relative_treshold+min