Added feedback control for a dynamic threshold