Move detectors code to a separate file