Don't let cleanFilename choke on an undefined or null value. Use an empty string. Closes #84.
Improve the code quality of the metadata generation routine.