updated threshold script