changed to dyanmic threshold.