refactor for consistent use of 'file' function