in reply to detection in Loop condition
You need to simplify the problem - the code that you have makes no sense.