simplify detect script