debugged scan_detector.c and scandd bash script