Further refactor of DetectorThread