Added file existence checking