Strip invalid XML characters
Add a new line to the end of generated scripts
Properly control stdout and stderr from command-line

Allow for output of last X lines
Changes back-end implementation of BufferedReaderThread which should
improve performance when stdout/stderr is not retained