Use communicate() rather than write() to pass the StringIO to Popen
Add command-line options for sensitivity and threshold