The script now uses the appropriate extension for the file.