Yeah I figure this could be factored into a library later on.
Lot of this stuff could be done without using rpc -- I actually started writing it that way but figured the first release would make more sense as a stand-alone escript.