remove the detect and replace it with for loop