add fuction for detection