Refactor set RPC