Still needs debugging. Regression tests of some examples; necessary revisions due to stronger checks at close_monitor.
Crudely carved out of an other repository - not sure that this works.