move all file operations to one module; widespread simplification