Each loop was changed to for