For loop addition, structural changes

Added for loop and changed things in the structure. Moved things around.