Update detection.cpp