Use getopt for arguments rather than sys.argv.
Switched from utf-8 to utf-8-sig for input compatibility.