More code clean-up of detector.