--wrapper-template implementation

Possible implementation for #898.

Not that many changes. Tests could be insufficient though...