refactor out rpc-server
all public apis take a single argument function (not counting callbacks)