Modernize the file handling

See title