Put common file operations in methods.