little changes to eventDetection