Pull from upstream

Pulling in upstream changes, mainly concerned with handling of terminators and generalizing of command formatting.