Added code to automatically resolve duplicate file names, per #357.