8c2d584
Rewrite based on discussion with Miro Hroncok (please "fixup" this commit before accepting the pull request)