improved on the detect command