refactored fileMethods