Support STOP_ON_SUCCESS

This adds support for the STOP_ON_SUCCESS option, related to #1307.  Also some minor cosmetic changes.