This is nice. I don't know how this skipped under my radar. Please add unit tests for it and also add it to the readme with an entry on the table of content (in a new PR).