add initial detect function