Keep logic the same but cycle through files, likely this should move to file level