harvested this RPC module from an earlier project, cleaned it up a bit