refactorings
separate loop for non-existent files