Updated file handling