Refactored for loop and ran  on both files