[RFC] Minor improvements to make the library a little more useful

I needed these changes for my particular use-case, but I think they are general enough that they can be accepted into upstream. These should not break API compatibility.