Oversimplifying detect script