partially fixed for each loop formatting