Better threshold finding for detector.