This moves some code from main.py to utils and strips special characters out of output filenames (fixes issue #6)