call detect function