Also set ip variable outside that loop