loop analysis Test added with some extra debug output plus flags