Simplify file handling and the confirmation prompt code