Make behavior of missing substituents match documentation.
Replace two can't-happen 'goto error's with asserts.
Better human-readable labels for test blocks.