Update rx for #61

This is a cursory upgrade and could be taken further. The tests all
pass, but I want to make sure this really works before cleaning up
further.

@mbossenbroek 
Why did I not just use f here? :)