In-progress work towards fixing the "stop" command.  Mostly re-introducing old code that got lost in the big merge.
#183