More code-improvements.

Code copied into 3 additional classes.  Not tested yet.