Replacement for @raoulb pr#914

See #914

ToDo:
- [x] tests
- [x] final rebase
Should the regular functions carry the same tag too?