Cleanups to RPC code.