simplified detector code