This seems to work ...

Not quite sure how to test it, though.