refactoring file utilities