added for loop and ns log