Added if statements to check for the existence of files before adding or removing them.