Added a test to see if file already exists.