WIP: Replacement for @raoulb pr#914

See #914

ToDo:
- [ ] tests
- [ ] final rebase