refactor inline file operations