More coverage

Continuing work in #1427 this improves coverage from:

```
Statements   : 95.89% ( 1377/1436 )
Branches     : 93.23% ( 744/798 )
Functions    : 94.71% ( 161/170 )
Lines        : 96.12% ( 1312/1365 )
```

to

```
Statements   : 97.39% ( 1380/1417 )
Branches     : 95% ( 741/780 )
Functions    : 95.81% ( 160/167 )
Lines        : 97.55% ( 1315/1348 )
```

by removing some un-used code, fixing a few other things and adding a few tests.