Added proper for loop snippet